/**
 * Created by ZhouWei on 2017/6/24.
 */
//假数据
var obj = [];
var missObj = [];
var recommend = [];
var lotteryTime;
var min = null;
var second = null;
var isChrome = navigator.userAgent.toLowerCase().match(/chrome/) != null;
var time;
var topHengDivHeight = 43;
var startX= 0;
var startY = 0;
var svgObj = [
    {
        fontColor:"black",
        bgColor:"#F0FFF8"
    },{
        fontColor:"black",
        bgColor:"#F0FFF8"
    },{
        fontColor:"black",
        bgColor:"#F0FFF8"
    },{
        fontColor:"black",
        bgColor:"#F0FFF8"
    },{
        fontColor:"black",
        bgColor:"#F0FFF8"
    },{
        fontColor:"black",
        bgColor:"#F0FFF8"
    }
    ,{
        lineColor:"black"
    }
];
var cssObj={
    zhibo:false,
    zitisheG:0,
    jiemian:0,
    quyuan:false,
    ziti:0,
    qianyiziti:false,
    qiansanziti:true,
    lianhaobeijing:false,
    show:{
        renxuanfenbu:true,
        qiansanweilianxian:true,
        guanzhuhaoma:true,
        sanweikaijianghao:false,
        chonghao:true,
        qianheweilianxian:false,
        hezhidaxiao:false,
        qianzhi:false,
        hezhidanshuang:false,
        hezhi:false,
        jishu:true,
        dashu:true,
        qianchong:false,
        qianchonglianxian:false,
        chonghaolianxian:false,
        qiansanzufenbu:false,
        kuadu:false,
        kuadulianxian:false,
        qiankua:false,
        qiankualianxian:false
    },
    Color:{
        qihaobg:$(".issueTwo").css("background-color"),
        qihaofc:$(".issueTwo").css("color"),
        wuweikaijianghaobg:$(".lotteryNumber").css("background-color"),
        wuweikaijianghaofc:$(".lotteryNumber").css("color"),
        renxuanfenbubg:$(".lotteryNumber").css("background-color"),
        renxuanfenbufc:$(".lotteryNumber").css("color"),
        qiansanweilianxianbg:$(".firstCon").css("background-color"),
        qiansanweilianxianfc:$(".firstCon").css("color"),
        guanzhuhaomabg:$(".attentionNum").css("background-color"),
        guanzhuhaomafc:$(".attentionNum").css("color"),
        sanweikaijianghaobg:$(".threeLotteryNumber").css("background-color"),
        sanweikaijianghaofc:$(".threeLotteryNumber").css("color"),
        qiansanheweilianxianbg:$(".firstThreeTails").css("background-color"),
        qiansanheweilianxianfc:$(".firstThreeTails").css("color"),
        hezhidaxiaobg:$(".firstThreeValuesBs").css("background-color"),
        hezhidaxiaofc:$(".firstThreeValuesBs").css("color"),
        qianzhibg:$(".firstThreeValues").css("background-color"),
        qianzhifc:$(".firstThreeValues").css("color"),
        hezhidanshuangbg:$(".andValueSd").css("background-color"),
        hezhidanshuangfc:$(".andValueSd").css("color"),
        hezhibg:$(".andValueAll").css("background-color"),
        hezhifc:$(".andValueAll").css("color"),
        jishubg:$(".Odd").css("background-color"),
        jishufc:$(".Odd").css("color"),
        dashubg:$(".bigNum").css("background-color"),
        dashufc:$(".bigNum").css("color"),
        qianchongbg:$(".theFormer").css("background-color"),
        qianchongfc:$(".theFormer").css("color"),
        qianchonglianxianbg:$(".theFormerLine").css("background-color"),
        qianchonglianxianfc:$(".theFormerLine").css("color"),
        chonghaobg:$(".heavyNumber").css("background-color"),
        chonghaofc:$(".heavyNumber").css("color"),
        chonghaolianxianbg:$(".heavyNumberLine").css("background-color"),
        chonghaolianxianfc:$(".heavyNumberLine").css("color"),
        qiansanzufenbubg:$(".threeGroupsDis").css("background-color"),
        qiansanzufenbufc:$(".threeGroupsDis").css("color"),
        kuadubg:$(".spanDataTable").css("background-color"),
        kuadufc:$(".spanDataTable").css("color"),
        kuadulianxianbg:$(".spanDataTableLine").css("background-color"),
        kuadulianxianfc:$(".spanDataTableLine").css("color"),
        qiankuabg:$(".beforeCross").css("background-color"),
        qiankuafc:$(".beforeCross").css("color"),
        qiankualianxianbg:$(".beforeCrossLine").css("background-color"),
        qiankualianxianfc:$(".beforeCrossLine").css("color"),
        lianxian:"rgb(0, 0, 0)",
    },

};//第一次进入此页面 需要存入数据库
var size = 22;
$(function(){
    $('#colorpicker').farbtastic('#color');
    userInfo();
    longClick();
    $(".statisticsRow td").css("color","#000");
});

function windowOnLoad(hhh) {
    ClassIndex2();
    if($("#svg")){
        $("#svg").remove();
    }
    $("#screenFull").show();
    $(".shuzhifang table tbody").children("*").remove();
    setTimeout(function () {
        getGameInfo();
        ajaxFunction();
        getRecommend();
        getMissing();
        if(min==null){
            getLottTime();
        }
        nextTable();
        if($(window).height()>1200){
            if (isChrome) {
                $("#header").height(0).css("display","none");
            }
            $(".dataTable").css("fontSize","11px");
            $(".shuzhifang table").css("fontSize","11px");
        }
        var numClassIndex2 = JSON.parse(localStorage.getItem("ClassIndex2"));
        if($(window).width()<1079){
            if(hhh == 0 || hhh ==-1){
                $(".dataTable").width("1060px");
            }else{
                if(numClassIndex2){
                    $(".dataTable").width("120px");
                    $("#topHengDiv table").width("120px");
                    for(var key in numClassIndex2){
                        if(numClassIndex2[key]){
                            var optionalDis = $("#templateTable .templateTr").children("."+key);
                            $(".dataTable").width($(".dataTable").width()+20*optionalDis.length+"px");
                            $("#topHengDiv table").width($("#topHengDiv table").width()+20*optionalDis.length+"px");
                        }
                    }
                }else{
                    $(".dataTable").width("1060px");
                }
            }
        }


        dataHandle(isChrome);
        //获取准备好的tr模板
        var tr = $("#templateTable .templateTr");
        var sale = $("#templateTable .templateTrLast");
        //所有开奖号统计数组
        var statistics =[];
        var firstStatistics = [];
        var secondStatistics = [];
        var thirdStatistics = [];
        //初始化计数数组
        var tempObj = [0,0,0,0,0,0,0,0,0,0,0,0];
        var tempFirst = [0,0,0,0,0,0,0,0,0,0,0,0];
        var tempSecond = [0,0,0,0,0,0,0,0,0,0,0,0];
        var tempThird = [0,0,0,0,0,0,0,0,0,0,0,0];
        var tempGroupsDis = [0,0,0,0,0,0,0,0,0,0,0,0];
        //二维数组将所有开奖号放到statistics中
        for(var g=0;g<obj.length;g++){
            for(var d=0;d<obj[g].kaijianghao.length;d++){
                if(d == 0){
                    firstStatistics.push(obj[g].kaijianghao[d]);
                }else if(d == 1){
                    secondStatistics.push(obj[g].kaijianghao[d]);
                }else if(d == 2){
                    thirdStatistics.push(obj[g].kaijianghao[d]);
                }
                statistics.push(obj[g].kaijianghao[d]);
            }
        }
        //tempObj用于存放统计次数 第一位的值代表1出现的次数 依次类推
        for(var c=0;c<statistics.length;c++){
            tempObj[statistics[c]-1]++;
        }
        var copyTempObj = tempObj.clone(); //冷号热号统计   项原型中添加数组clone 和冒泡排序方法
        var lenghaoOne,lenghaoTwo,rehaoOne,rehaoTwo;
        copyTempObj.bubbleSort();
        for(var g=0;g<copyTempObj.length;g++){
            if(copyTempObj[0] == tempObj[g] && lenghaoOne==undefined){
                lenghaoOne = g;
            }else if(copyTempObj[1] == tempObj[g] && lenghaoTwo==undefined){
                lenghaoTwo = g;
            }else if(copyTempObj[copyTempObj.length-2] == tempObj[g] && rehaoOne==undefined){
                rehaoOne =g;
            }else if(copyTempObj[copyTempObj.length-1] == tempObj[g] && rehaoTwo==undefined){
                rehaoTwo = g;
            }
        }
        //tempFirst
        for(var c=0;c<firstStatistics.length;c++){
            tempFirst[firstStatistics[c]-1]++;
        }
        //tempSecond
        for(var c=0;c<firstStatistics.length;c++){
            tempSecond[secondStatistics[c]-1]++;
        }
        //tempThird
        for(var c=0;c<thirdStatistics.length;c++){
            tempThird[thirdStatistics[c]-1]++;
        }
        //tempThird
        for(var c=0;c<thirdStatistics.length;c++){
            tempGroupsDis[thirdStatistics[c]-1]++;
        }
        for(var c=0;c<thirdStatistics.length;c++){
            tempGroupsDis[secondStatistics[c]-1]++;
        }
        for(var c=0;c<thirdStatistics.length;c++){
            tempGroupsDis[firstStatistics[c]-1]++;
        }
        //根据传过来的数据多少创建空白行
        for(var i=0;i<obj.length+2;i++){
            //创建多行空白的带有class的tr
            $(".shuzhifang table tbody").append("<tr><td class='issueTwo'></td></tr>");
            if(i == obj.length){   //倒计时行
                var saleClone =sale.clone();
                $(".dataTable tbody").append(saleClone);
                //填入期号
                $(".shuzhifang table tbody tr").eq(i).find(".issueTwo").eq(0).html(lotteryTime.next_stage);
                //填入倒计时
                $(".dataTable tbody tr").eq(i).find('.countDownd').css("color","red").html("00:00");
                clearInterval(time);
                if(lotteryTime.text != "暂未开售"){
                    time = setInterval(function(){
                        lotteryTime.n_time = lotteryTime.n_time -1;
                        min = parseInt(lotteryTime.n_time/60);
                        second = lotteryTime.n_time%60;
                        if(second<10){
                            second = "0"+second;
                        }
                        if(min<2){
                            $(".dataTable tbody tr").eq(obj.length).find('.countDownd').html("开奖中").addClass("countDownd1");
                        }else{
                            $(".dataTable tbody tr").eq(obj.length).find('.countDownd').html("0"+min+":"+second).removeClass("countDownd1");
                        }
                        if(min==0 && second==0){
                            clearInterval(time);
                            $(".dataTable tbody").children("*").remove();
                            min = null;
                            windowOnLoad();
                            nextTable();
                            $(".attentionNumRed").css("color","#f00");
                            $(".optionalDisBlue").css("color","#fff");
                            $(".optionalDisRed").css("color","#fff");
                            qihaoshezhi();
                            quyuanjiance();
                            backgroundSize()
                        }
                    },1000);
                }else{
                    $(".dataTable tbody tr").eq(obj.length).find('.countDownd').html(lotteryTime.text);
                }
                //关注号码
                var a = 0;
                $(".dataTable tbody tr").eq(i).find('.attentionNum').each(function(){
                    $(this).html(lotteryTime.guanzhu[a]);
                    a++;
                });
            }else if(i == obj.length+1){          //统计行
                var trClone =tr.clone();
                $(".dataTable tbody").append(trClone);
                //填入0
                var v = 0;
                $(".dataTable tbody tr").eq(i).find('td').each(function(){
                    $(this).html(0).css('background','#00A6A6');
                    v++;
                });
                //填入总期数
                $(".dataTable tbody tr").eq(i).addClass("statisticsRow");
                $(".dataTable tbody tr").eq(i).find(".issue").eq(0).html(obj.length).css('background','#00A6A6');
                $(".shuzhifang table tbody tr").eq(i).find(".issueTwo").eq(0).html(obj.length).addClass("statisticsRowLeft");
                //任选分布
                var e = 0;
                $(".dataTable tbody tr").eq(i).find('.optionalDis').each(function(){
                    $(this).html(tempObj[e]).css('background','#00A6A6');
                    if(e == lenghaoOne || e == lenghaoTwo){
                        $(this).html(tempObj[e]).addClass('lenghao').css("background-color","#63cb75");
                    }else if(e == rehaoOne || e==rehaoTwo){
                        $(this).html(tempObj[e]).addClass('rehao').css("background-color","#f60");
                    }else{
                        $(this).html(tempObj[e]).css('background','#00A6A6');
                    }
                    e++;
                });
                //第一位统计
                var first=0;
                $(".dataTable tbody tr").eq(i).find('.firstCon').each(function(){
                    $(this).html(tempFirst[first]).css('background','#00A6A6');
                    first++;
                });
                //第二位统计
                var second=0;
                $(".dataTable tbody tr").eq(i).find('.secondCon').each(function(){
                    $(this).html(tempSecond[second]).css('background','#00A6A6');
                    second++;
                });
                //第三位统计
                var third=0;
                $(".dataTable tbody tr").eq(i).find('.thirdCon').each(function(){
                    $(this).html(tempThird[third]).css('background','#00A6A6');
                    third++;
                });
                //前三位开奖号统计
                var GroupsDis=0;
                $(".dataTable tbody tr").eq(i).find('.threeGroupsDis').each(function(){
                    $(this).html(tempGroupsDis[GroupsDis]).css('background','#00A6A6');
                    GroupsDis++;
                });
            }else{
                var trClone =tr.clone();
                $(".dataTable tbody").append(trClone);
                //填入期号
                obj[i].qihao = obj[i].qihao.substr(obj[i].qihao.length-2,2);
                $(".shuzhifang table tbody tr").eq(i).find(".issueTwo").eq(0).html(obj[i].qihao);
                //将开奖号填入表格
                var j = 0;
                $(".dataTable tbody tr").eq(i).find('.lotteryNumber').each(function(){
                    var numKaijianghao = Number(obj[i].kaijianghao[j]);
                    if(numKaijianghao<=9){
                        obj[i].kaijianghao[j] = obj[i].kaijianghao[j].substring(1);
                    }
                    $(this).html(obj[i].kaijianghao[j]);
                    j++;
                });
                if($(".optionalDis").css("display")!="none"){
                    //任选分布
                    var k = 1;
                    $(".dataTable tbody tr").eq(i).find('.optionalDis').each(function(){
                        for(var m=0;m<obj[i].kaijianghao.length;m++){
                            if(obj[i].kaijianghao[m] == k){
                                if(m<3){
                                    $(this).addClass("optionalDisRed").css("color","#fff");
                                }else{
                                    $(this).addClass("optionalDisBlue").css("color","#fff");
                                }
                                $(this).html(obj[i].kaijianghao[m]);
                            }
                        }
                        k++;
                    });
                    //任选分布遗漏
                    var k=1;
                    $(".dataTable tbody tr").eq(i).find('.optionalDis').each(function(){
                        if(obj[i].danhaoyilou[k] !=0){
                            $(this).html(obj[i].danhaoyilou[k]);
                            $(this).addClass("missVlu");
                        }
                        k++;
                    });
                }
                if($(".attentionNum").css("display")!="none"){
                    //关注号码
                    var a = 0;
                    $(".dataTable tbody tr").eq(i).find('.attentionNum').each(function(){
                        $(this).html(obj[i].guanzhu[a]);
                        for(var num=0;num<obj[i].kaijianghao.length;num++){
                            if(obj[i].guanzhu[a] == obj[i].kaijianghao[num]){
                                $(this).addClass("attentionNumRed");
                            }
                        }
                        a++;
                    });
                }

                if($(".threeLotteryNumber").css("display")!="none"){
                    //前三位
                    var j = 0;
                    $(".dataTable tbody tr").eq(i).find('.threeLotteryNumber').each(function(){
                        $(this).html(obj[i].kaijianghao[j]);
                        j++;
                    });
                }

                if($(".heavyNumber").css("display")!="none"){
                    //重号
                    $(".dataTable tbody tr").eq(i).find('.heavyNumber').each(function(){
                        $(this).html(obj[i].chonghao);
                    });
                }

                if($(".firstThreeValues").css("display")!="none"){
                    //前三和值
                    $(".dataTable tbody tr").eq(i).find('.firstThreeValues').each(function(){
                        $(this).html(obj[i].qiansanhezhi);
                    });
                }

                if($(".andValueAll").css("display")!="none"){
                    //总的和值
                    $(".dataTable tbody tr").eq(i).find('.andValueAll').each(function(){
                        $(this).html(obj[i].hezhi);
                    });
                }

                if($(".theFormer").css("display")!="none"){
                    //前重
                    $(".dataTable tbody tr").eq(i).find('.theFormer').each(function(){
                        $(this).html(obj[i].qiansanchonghao);
                    });
                }

                if($(".Odd").css("display")!="none"){
                    //奇数
                    $(".dataTable tbody tr").eq(i).find('.Odd').each(function(){
                        $(this).html(obj[i].jishu);
                    });
                }

                if($(".bigNum").css("display")!="none"){
                    //大数
                    $(".dataTable tbody tr").eq(i).find('.bigNum').each(function(){
                        $(this).html(obj[i].dashu);
                    });
                }

                if($(".threeGroupsDis").css("display")!="none"){
                    //前三组分布
                    var k = 1;
                    $(".dataTable tbody tr").eq(i).find('.threeGroupsDis').each(function(){
                        for(var m=0;m<3;m++){
                            if(obj[i].kaijianghao[m] == k){
                                $(this).html(obj[i].kaijianghao[m]);
                            }
                        }
                        k++;
                    });
                }

                if($(".spanDataTable").css("display")!="none"){
                    //跨度
                    $(".dataTable tbody tr").eq(i).find('.spanDataTable').each(function(){
                        $(this).html(obj[i].kuadu);
                    });
                }

                if($(".beforeCross").css("display")!="none"){
                    //前跨
                    $(".dataTable tbody tr").eq(i).find('.beforeCross').each(function(){
                        $(this).html(obj[i].qiankua);
                    });
                }
            }
        }
        if($(window).height()>1200){
            if (isChrome) {
                $(".optionalDisRed").css("background-size","18px 21px");
                $(".optionalDisBlue").css("background-size","18px 21px");
            }else{
                $(".optionalDisRed").css("background-size","18px 21px");
                $(".optionalDisBlue").css("background-size","18px 21px");
            }
            $(".shuzhifang table tr td").css("fontSize","11px");
        }
        if($(window).width()>1080){
            topHengDivHeight = $("#topHengDiv").height();
            $("#qihao table tr th").height(topHengDivHeight-3+"px");
        }
        $(".issue").remove();
        $(".dataTable .templateTrLast td").eq(0).remove();
        if($(".dataTable tbody tr td").css("font-family")=="ZT02"){
            $(".shuzhifang table tbody tr td").css("font-size","12px")
        }else{
            $(".shuzhifang table tbody tr td").css("font-size","15px")
        }
        svg(svgObj);
        qihaoshezhi();
        quyuanjiance();
        $(".attentionNumRed").css("color","#f00");
    },10)
}

function qihaoshezhi() {
    var colorb1=$("#qihao table tbody tr th").eq(0).css("color");
    var colorb2=$("#qihao table tbody tr th").eq(0).css("background-color");
    $(".issueTwo").css("background-color",colorb2);
    $(".statisticsRowLeft.issueTwo ").css("background-color","#00a6a6").css("color","#000000");
    $(".issueTwo").css("color",colorb1);
    $(".statisticsRowLeft.issueTwo ").css("color","#000000");
}

function dataHandle(isChrome) {
    var winHeight=$(window).height();

    if($(window).width()<1050){
        $(".main").height(winHeight - $("#bottom table").height() - $("#groomNum").height()-45);
        $("#functionArea").height($("#bottom table").height() + $("#groomNum").height()-1);
        $(".shuzhifang").height($(".main").height() - $("#qihao").height());
        $("#zhuti").height($(".main").height() - $("#qihao").height());
    }else{
        if (isChrome) {
            if($(window).height()>1500){
                $(".dataTable").height(winHeight - 202 - $("#topHengDiv").height());
                $(".shuzhifang table").height(winHeight - 202 - $("#topHengDiv").height());
            }else{
                $(".dataTable").height(winHeight - 233 -$("#topHengDiv").height());
                $(".shuzhifang table").height(winHeight - 233 - $("#topHengDiv").height());
            }
        }else{
            $(".dataTable").height(winHeight - 233 - $("#topHengDiv").height());
            $(".shuzhifang table").height(winHeight - 233 - $("#topHengDiv").height());
        }
    }
}

function svg(svgObj){
    //坐标存放数组
    var coordinateRectF=[];
    var coordinateRectS=[];
    var coordinateRectT=[];
    var coordinateRectTails=[];    //前三和尾连线
    var coordinateRectFormer=[];  //前重连线
    var coordinateRectHeavy = []; //重号连线
    var coordinateRectSpan = []; //跨度连线
    var coordinateRectCross = []; //前跨连线

    var height = $('.dataTable').height();
    var width = $('.dataTable').width();
    var he = $(".dataTable tbody tr").eq(0).height()/2;
    var wi = $(".dataTable tbody tr").eq(0).find(".lotteryNumber").eq(0).width()/2;

    var arraySvgF = [];
    var arraySvgS = [];
    var arraySvgT = [];
    var arraySvgTails = [];
    var arraySvgFormer = [];
    var arraySvgHeavy = [];
    var arraySvgSpan = [];
    var arraySvgCross = [];


    var allCoordinateRect = [];

    startX = 0;
    startY = 0;
    $("#zhuti .dataTable").css('transform', 'translate(' + (startX) + 'px,'+startY+'px) translateZ(0px)');
    $("#topHengDiv table").css('transform', 'translate(' + (startX) + 'px,0px) translateZ(0px)');
    $("#svg").css('transform', 'translate(' + (0) + 'px,'+0+'px) translateZ(0px)');
    $(".shuzhifang table").css('transform', 'translate(0px,' + (startY) + 'px) translateZ(0px)');

    for(var i=0;i<obj.length;i++){
        if($(".firstCon").css("display") != "none"){
            //第一位连线
            var firstCon = $(".dataTable tbody tr").eq(i).find('.firstCon');
            getCoord(firstCon,coordinateRectF,obj[i].kaijianghao[0],1);
            var secondCon = $(".dataTable tbody tr").eq(i).find('.secondCon');
            getCoord(secondCon,coordinateRectS,obj[i].kaijianghao[1],1);
            var thirdCon = $(".dataTable tbody tr").eq(i).find('.thirdCon');
            getCoord(thirdCon,coordinateRectT,obj[i].kaijianghao[2],1);
        }
        if($(".firstThreeTails").css("display") != "none"){
            var firstThreeTails = $(".dataTable tbody tr").eq(i).find('.firstThreeTails');
            getCoord(firstThreeTails,coordinateRectTails,obj[i].qiansanhewei);
        }
        if($(".theFormerLine").css("display") != "none"){
            //前重连线
            var theFormer = $(".dataTable tbody tr").eq(i).find('.theFormerLine');
            getCoord(theFormer,coordinateRectFormer,obj[i].qiansanchonghao);
        }
        if($(".heavyNumberLine").css("display") != "none"){
            //重号连线
            var heavyNumberLine = $(".dataTable tbody tr").eq(i).find('.heavyNumberLine');
            getCoord(heavyNumberLine,coordinateRectHeavy,obj[i].chonghao);
        }
        if($(".spanDataTableLine").css("display") != "none"){
            var spanDataTableLine = $(".dataTable tbody tr").eq(i).find('.spanDataTableLine');
            getCoord(spanDataTableLine,coordinateRectSpan,obj[i].kuadu,2);
        }
        if($(".beforeCrossLine").css("display") != "none"){
            var beforeCrossLine = $(".dataTable tbody tr").eq(i).find('.beforeCrossLine');
            getCoord(beforeCrossLine,coordinateRectCross,obj[i].qiankua,3);
        }
    }

    function getCoord(nodeClass,coordinateRect,val,tag) {
        var valPos;
        if(tag == 1){
            valPos = val - 1;
        }else if(tag == 2){
            valPos = val - 4;
        }else if(tag == 3){
            valPos = val - 2;
        }else{
            valPos = val;
        }
        var top = nodeClass.eq(valPos).position().top;
        var left = nodeClass.eq(valPos).position().left;
        var rectF = {
            top:top,
            left:left,
            val:val
        };
        coordinateRect.push(rectF);
    }
    if($("#svg")){
        $("#svg").remove();
    }

    var svg = $("<svg id='svg' version='1.1' xmlns='http://www.w3.org/2000/svg'></svg>");
    svg.attr("height",height).attr('width',width);
    $("#zhuti").append(svg);

    //画线
    var lineWidth = 1;

    var xxx = 1;
    var yyy = 7.5;
    if(fontFamily == "ZT02"){
        yyy = 5.5;
    }

    if($(window).height()>1200){
        size = 16;
        xxx =0;
        lineWidth = 0.5;
    }

    if($(".firstCon").css("display") != "none"){
        drawLine(coordinateRectF,arraySvgF);
        drawLine(coordinateRectS,arraySvgS);
        drawLine(coordinateRectT,arraySvgT);
    }

    if($(".firstThreeTails").css("display") != "none"){
        drawLine(coordinateRectTails,arraySvgTails);
    }

    if($(".theFormerLine").css("display") != "none"){
        //前重连线
        drawLine(coordinateRectFormer,arraySvgFormer);
    }

    if($(".heavyNumberLine").css("display") != "none"){
        //重号连线
        drawLine(coordinateRectHeavy,arraySvgHeavy);
    }

    if($(".spanDataTableLine").css("display") != "none"){
        //跨度连线
        drawLine(coordinateRectSpan,arraySvgSpan);
    }

    if($(".beforeCrossLine").css("display") != "none"){
        //前跨连线
        drawLine(coordinateRectCross,arraySvgCross);
    }

    var indexOne,indexTwo,indexThree,indexFour,indexFive,indexSix;

    indexOne = allCoordinateRect.indexOf(coordinateRectF);

    indexTwo = allCoordinateRect.indexOf(coordinateRectTails);

    indexThree = allCoordinateRect.indexOf(coordinateRectFormer);

    indexFour = allCoordinateRect.indexOf(coordinateRectHeavy);

    indexFive = allCoordinateRect.indexOf(coordinateRectSpan);

    indexSix = allCoordinateRect.indexOf(coordinateRectCross);

    var color;
    var fontColor;
    if(!fontFamily){
        fontFamily = "IskoolaPota"
    }
    if(allCoordinateRect.length == 0){
        $("#screenFull").hide();
        iscroll();
    }
    for(var p=0;p<allCoordinateRect.length;p++){
        if(p == indexTwo){
            color = svgObj[1].bgColor;
            fontColor = svgObj[1].fontColor;
        }else if(p == indexThree){
            color = svgObj[2].bgColor;
            fontColor = svgObj[2].fontColor;
        }else if(p == indexFour){
            color = svgObj[3].bgColor;
            fontColor = svgObj[3].fontColor;
        }else if(p == indexFive){
            color = svgObj[4].bgColor;
            fontColor = svgObj[4].fontColor;
        }else if(p == indexSix){
            color = svgObj[5].bgColor;
            fontColor = svgObj[5].fontColor;
        }else if(indexOne>-1){
            if(p == indexOne || p==indexOne+1 || p==indexOne+2){
                color = svgObj[0].bgColor;
                fontColor = svgObj[0].fontColor;
            }
        }else{
            break;
        }

        for(var y=0;y<allCoordinateRect[p].length;y++){

            if(y == allCoordinateRect[p].length -1){
                $("#screenFull").hide();
                iscroll();
            }
            var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
            var text = document.createElementNS("http://www.w3.org/2000/svg", "text");
            $(rect).attr("x", allCoordinateRect[p][y].left-wi+wi*3/5).attr("y",allCoordinateRect[p][y].top-he+he/5).attr("width",wi*6/5).attr("height",he*8/5);
            $(rect).attr("fill",color);
            $(text).attr("x", allCoordinateRect[p][y].left+xxx).attr("y",allCoordinateRect[p][y].top+yyy);
            $(text).attr("text-anchor","middle").text(allCoordinateRect[p][y].val);
            $(text).attr("font-size",size).attr("letter-spacing","-1").attr("font-family",fontFamily).attr("fill",fontColor);
            svg.append(rect);
            svg.append(text);
        }
    }
    function drawLine(coordinateRect,arraySvg){
        for (var u=0;u<coordinateRect.length;u++){
            coordinateRect[u].left = coordinateRect[u].left+wi;
            coordinateRect[u].top = coordinateRect[u].top+he;
            arraySvg.push(coordinateRect[u].left+","+coordinateRect[u].top);
        }

        var FormerLine = document.createElementNS("http://www.w3.org/2000/svg", "polyline");
        FormerLine.setAttribute("fill", "none");
        FormerLine.setAttribute("points", arraySvg);
        FormerLine.setAttribute("stroke", svgObj[6].lineColor);
        FormerLine.setAttribute("stroke-width", lineWidth);
        svg.append(FormerLine);
        allCoordinateRect.push(coordinateRect);
    }
}

function nextTable() {
    var bottomTable = $("#bottomTable tbody tr");
    var tr = bottomTable.length;

    if(typeof recommend[1][1] == "string"){
        for(var q=0;q<recommend.length;q++){
            recommend[q][1]  = recommend[q][1].split(",");
            recommend[q][4]  = recommend[q][4].split(",");
        }
    }

    for(var i=0;i<8;i++){

        if(i%2 ==0) {
            $("#bottomTable tbody tr").eq(i).css("background","#F1F1D6");
        }else{
            $("#bottomTable tbody tr").eq(i).css("background","#DBECC7");
        }
        var name = i==0 ? ".flagOne" : i==1 ? ".flagTwo" : i==2 ? ".flagThree" :i==3 ? ".flagFour" :i==4 ? ".flagFive"
            :i==5 ? ".flagSix" : i == 6 ? ".flagSeven" : i==7 ? ".flagEight" : ".flagOne";
        var k = 0;
        $("#bottomTable tbody tr").find(name).each(function () {
            if(k == 0){
                $(this).html(missObj[i].号码);
            }else if (k==1){
                $(this).html(missObj[i].当前遗漏);
            }else if (k==2){
                $(this).html(missObj[i].上次遗漏);
            }else{
                $(this).html(missObj[i].历史遗漏);
            }
            k++;
        });
    }

    for(var j=0;j<$("#groomNum tbody tr").length;j++){
        var k=0;
        var r=0;
        var g =0;
        $("#groomNum tbody tr").eq(j).find("td").each(function(){
            if(k==1 || k==2 || k==3){
                if(recommend[j][1][r].indexOf("√")>-1){
                    $(this).css("color","red");
                }
                $(this).html(recommend[j][1][r]);
                r++;
            }else if(k ==6 || k==7 || k==8){
                if(recommend[j][4][g].indexOf("√")>-1){
                    $(this).css("color","red");
                }
                $(this).html(recommend[j][4][g]);
                g++;
            }else if(k ==4 || k==5){
                $(this).html(recommend[j][k-2]);
            }else if(k==9){
                $(this).html(recommend[j][k-4]);
            }else{
                $(this).html(recommend[j][k]);
            }
            k++
        })
    }
}

//功能区点击事件
//直播开奖等~~~非会员功能
//是否直播
$(".optionsBtn").eq(0).click(function () {
    var closeOrOpen=$(".optionsBtn img").eq(0).attr("src");
    if(closeOrOpen=='img/close.png'){
        $(".optionsBtn img").eq(0).attr("src","img/open.png");
        cssObj.zhibo=true;
    }else{
        $(".optionsBtn img").eq(0).attr("src","img/close.png");
        cssObj.zhibo=false
    }
    changeSetting();
});
//红-紫
$(".optionsBtn").eq(1).click(function () {
    $(".otherOptions").eq(0).toggle();
    if($(window).width()>500){
        if(!$(".otherOptions").eq(0).is(":hidden")){
            $(".otherOptions2").eq(0).css("bottom","300px");
            $(".otherOptions").eq(0).css("bottom","60px")
        }else{
            $(".otherOptions2").eq(0).css("bottom","120px")
        }
    }else{
        $(".otherOptions2").eq(0).hide();
    }
});
//界面1
$(".optionsBtn").eq(2).click(function () {
    $(".otherOptions").eq(1).toggle();
    if($(window).width()>500){
        if(!$(".otherOptions").eq(1).is(":hidden")){
            $(".otherOptions2").eq(1).css("bottom","300px");
            $(".otherOptions").eq(1).css("bottom","60px")
        }else{
            $(".otherOptions2").eq(1).css("bottom","120px")
        }
    }else{
        $(".otherOptions2").eq(1).hide();
    }
});
//显示设置
$(".optionsBtn").eq(3).click(function () {
    $(".optionsList").toggle();
    $(".InterfaceColor").toggle();
});
//去圆
$(".optionsBtn").eq(4).click(function () {
    var closeOrOpen=$(".optionsBtn img").eq(1).attr("src");
    if(closeOrOpen=='img/close.png'){

        $(".optionsBtn img").eq(1).attr("src","img/open.png");
        $(".optionsBtn img").eq(2).attr("src","img/close.png");
        $(".optionsBtn img").eq(3).attr("src","img/close.png");
        $(".optionalDisRed").css("background-image","url()");
        $(".optionalDisBlue").css("background-image","url()");
        $(".optionalDisBlue").css("color",$("#HengDiv .optionalDis").css("color")).css("font-weight","500");
        $(".optionalDisRed").css("color",$("#HengDiv .optionalDis").css("color")).css("font-weight","500");
        cssObj.quyuan=true;
        cssObj.qianyiziti=false;
        cssObj.qiansanziti=false;

    }else{
        $(".optionsBtn img").eq(1).attr("src","img/close.png");
        $(".optionalDisRed").css("background-image","url(./img/blue.png)").css("background-size","18px 21px");
        $(".optionalDisBlue").css("background-image","url(./img/blue.png)").css("background-size","18px 21px");

        $(".optionsBtn img").eq(2).attr("src","img/close.png");

        $(".optionalDisBlue").css("color","#ffffff").css("font-weight","500");
        $(".optionalDisRed").css("color","#ffffff").css("font-weight","500");
        cssObj.quyuan=false;
    }
    $(".missVlu").css("color","#999");
    backgroundSize()
    changeSetting();
});
//字体1
$(".optionsBtn").eq(5).click(function () {
    $(".otherOptions2").eq(0).toggle();
    if($(window).width()>500){
        if(!$(".otherOptions").eq(0).is(":hidden")){
            $(".otherOptions2").eq(0).css("bottom","300px");
            $(".otherOptions").eq(0).css("bottom","60px")
        }else{
            $(".otherOptions2").eq(0).css("bottom","120px")
        }
    }else{
        $(".otherOptions").eq(0).hide();
    }
});
//30期
$(".optionsBtn").eq(6).click(function () {
    $(".otherOptions2").eq(1).toggle();
    if($(window).width()>500){

        if(!$(".otherOptions").eq(1).is(":hidden")){
            $(".otherOptions2").eq(1).css("bottom","300px");
            $(".otherOptions").eq(1).css("bottom","60px")
        }else{
            $(".otherOptions2").eq(1).css("bottom","120px")
        }
    }else{
        $(".otherOptions").eq(1).hide();
    }
});
//登录注册
$(".optionsBtn").eq(7).click(function () {
    window.location.href="home1.html";
});
//前一字体色
$(".optionsBtn").eq(8).click(function () {

    var closeOrOpen=$(".optionsBtn img").eq(2).attr("src");
    if(closeOrOpen=='img/close.png'){
        $(".optionalDisBlue").css("color","#ffffff").css("font-weight","500");
        $(".optionalDisRed").css("color","#ffffff").css("font-weight","500");
        $(".optionalDisRed").css("background-image","url(./img/red.png)").css("background-size","18px 21px");
        $(".optionalDisBlue").css("background-image","url(./img/blue.png)").css("background-size","18px 21px");
        $(".optionsBtn img").eq(2).attr("src","img/open.png");
        $(".optionsBtn img").eq(3).attr("src","img/close.png");
        $(".optionsBtn img").eq(1).attr("src","img/close.png");
        $(".optionalDisRed").css("background-image","url(./img/blue.png)").css("background-size","18px 21px");
        //方法
        var first=[];
        for(var i=1;i<$(".dataTable tbody tr").length-1;i++){
            first[i-1]=$(".lotteryNumber").eq(i*5+1).html();
        }
        for(var i=1;i<$(".dataTable tbody tr").length;i++){
            $(".dataTable tbody tr").eq(i-1).find(".optionalDis").eq(first[i-1]-1).css("background-image","url(./img/red.png)").css("background-size","18px 21px");
        }
        cssObj.quyuan=false;
        cssObj.qianyiziti=true;
        cssObj.qiansanziti=false;
    }else{
        $(".optionalDisRed").css("background-image","url(./img/blue.png)").css("background-size","18px 21px");
        $(".optionsBtn img").eq(2).attr("src","img/close.png");
        $(".optionalDisBlue").css("color","#ffffff").css("font-weight","500");
        $(".optionalDisRed").css("color","#ffffff").css("font-weight","500");
        cssObj.qianyiziti=false;
    }
    changeSetting();
});
//前三字体色
$(".optionsBtn").eq(9).click(function () {
    $(".optionalDisBlue").css("color","#ffffff").css("font-weight","500");
    $(".optionalDisRed").css("color","#ffffff").css("font-weight","500");
    var closeOrOpen=$(".optionsBtn img").eq(3).attr("src");
    if(closeOrOpen=='img/close.png'){
        $(".optionsBtn img").eq(1).attr("src","img/close.png");
        $(".optionalDisRed").css("background-image","url(./img/red.png)").css("background-size","18px 21px");
        $(".optionalDisBlue").css("background-image","url(./img/blue.png)").css("background-size","18px 21px");
        $(".optionsBtn img").eq(3).attr("src","img/open.png");
        $(".optionalDisRed").css("background-image","url(./img/red.png)").css("background-size","18px 21px");
        $(".optionsBtn img").eq(2).attr("src","img/close.png");
        cssObj.qiansanziti=true;
        cssObj.quyuan=false;
        cssObj.qianyiziti=false;
    }else{
        $(".optionsBtn img").eq(3).attr("src","img/close.png");
        $(".optionalDisRed").css("background-image","url(./img/blue.png)").css("background-size","18px 21px");
        cssObj.qiansanziti=false;
    }
    changeSetting()
});
//连号背景色
$(".optionsBtn").eq(10).click(function ewq() {

    var closeOrOpen=$(".optionsBtn img").eq(4).attr("src");
    if(closeOrOpen=='img/close.png'){
        cssObj.lianhaobeijing=true;
        $(".optionsBtn img").eq(4).attr("src","img/open.png");
        //连号处理方法
        var arrX=[];
        for(var i=0;i<obj.length;i++){
            arrX[i]=[];
            for(var j=0;j<obj[i].kaijianghao.length;j++){
                arrX[i][j]=obj[i].kaijianghao[j];
            }
            arrX[i]=arrX[i].sort(sortNumber);
        }
        for(var iq=0;iq<arrX.length;iq++){
            var index0= arrX[iq][0];
            var index1= arrX[iq][1];
            var index2= arrX[iq][2];
            var index3= arrX[iq][3];
            var index4= arrX[iq][4];
            if(parseInt(index0)+2==parseInt(index1)+1&&parseInt(index1)+1==index2){
                $(".dataTable tbody tr").eq(iq).find(".optionalDis").eq(index0-1).css("background-color","#f60");
                $(".dataTable tbody tr").eq(iq).find(".optionalDis").eq(index1-1).css("background-color","#f60");
                $(".dataTable tbody tr").eq(iq).find(".optionalDis").eq(index2-1).css("background-color","#f60");
                if(parseInt(index2)+1==index3){
                    $(".dataTable tbody tr").eq(iq).find(".optionalDis").eq(index3-1).css("background-color","#f60");
                }
                if(parseInt(index2)+1==index3&&parseInt(index3)+1==index4){
                    $(".dataTable tbody tr").eq(iq).find(".optionalDis").eq(index4-1).css("background-color","#f60");
                }
            }else if(parseInt(index1)+2==parseInt(index2)+1&&parseInt(index2)+1==index3){
                $(".dataTable tbody tr").eq(iq).find(".optionalDis").eq(index1-1).css("background-color","#f60");
                $(".dataTable tbody tr").eq(iq).find(".optionalDis").eq(index2-1).css("background-color","#f60");
                $(".dataTable tbody tr").eq(iq).find(".optionalDis").eq(index3-1).css("background-color","#f60");
                if(parseInt(index3)+1==index4){
                    $(".dataTable tbody tr").eq(iq).find(".optionalDis").eq(index4-1).css("background-color","#f60");
                }
            }else if(parseInt(index2)+2==parseInt(index3)+1&&parseInt(index3)+1==index4){
                $(".dataTable tbody tr").eq(iq).find(".optionalDis").eq(index2-1).css("background-color","#f60");
                $(".dataTable tbody tr").eq(iq).find(".optionalDis").eq(index3-1).css("background-color","#f60");
                $(".dataTable tbody tr").eq(iq).find(".optionalDis").eq(index4-1).css("background-color","#f60");
            }
            $(".statisticsRow .optionalDis").css("background-color","#00a6a6")
        }
    }else{
        cssObj.lianhaobeijing=false;
        $(".optionsBtn img").eq(4).attr("src","img/close.png");
        $(".optionalDis").css("background-color",$(".optionalDis").eq(0).css("background-color"));
        $(".statisticsRow .optionalDis").css("background-color","#00a6a6")
    }
    changeSetting();
});
function sortNumber(a,b) {
    return a - b
}
//切换游戏
$(".optionsBtn").eq(11).click(function () {
    location.href="home1.html";
});
/*选项具体值开始*/
//字体背景色
$(".liStyle1").click(function () {
    var index=$(this).index();
    $(".content23").eq(0).html($(".liStyle1").eq(index).html());
    if(index==0){//红-紫

        cssObj.zitisheG=0;
        $(".optionalDis").css("color","#ffffff");
        $(".lotteryNumber").css("color","#7A056B");
        $(".attentionNumRed").css("color","#f00");
        $(".heavyNumber").css("color","#7A056B");
        $(".Odd").css("color","#7A056B");
        $(".bigNum").css("color","#f00");

        $(".firstThreeTails").css("color","#7A056B");
        $(".firstThreeValuesBs").css("color","#f00");
        $(".firstThreeValues").css("color","#7A056B");
        $(".andValueSd").css("color","#7A056B");
        $(".andValueAll").css("color","#f00");
        $(".threeLotteryNumber").css("color","#7A056B");
        $(".threeGroupsDis").css("color","#f00");
        $(".heavyNumberLine").css("color","#7A056B");

        $(".theFormerLine").css("color","#7A056B");
        $(".theFormer").css("color","#f00");
        $(".beforeCrossLine").css("color","#7A056B");
        $(".spanDataTableLine").css("color","#f00");
        $(".spanDataTable").css("color","#7A056B");
        $(".beforeCross").css("color","#f00");

        cssObj.Color.qihaobg=$(".issue").css("background-color");
        cssObj.Color.qihaofc=$(".issue").css("color");
        cssObj.Color.wuweikaijianghaobg=$(".lotteryNumber").css("background-color");
        cssObj.Color.wuweikaijianghaofc=$(".lotteryNumber").css("color");
        cssObj.Color.renxuanfenbubg=$(".lotteryNumber").css("background-color");
        cssObj.Color.renxuanfenbufc=$(".lotteryNumber").css("color");
        cssObj.Color.qiansanweilianxianbg=$(".firstCon").css("background-color");
        cssObj.Color.qiansanweilianxianfc=$(".firstCon").css("color");
        cssObj.Color.guanzhuhaomabg=$(".attentionNum").css("background-color");
        cssObj.Color.guanzhuhaomafc=$(".attentionNum").css("color");
        cssObj.Color.sanweikaijianghaobg=$(".threeLotteryNumber").css("background-color");
        cssObj.Color.sanweikaijianghaofc=$(".threeLotteryNumber").css("color");
        cssObj.Color.qiansanheweilianxianbg=$(".firstThreeTails").css("background-color");
        cssObj.Color.qiansanheweilianxianfc=$(".firstThreeTails").css("color");
        cssObj.Color.hezhidaxiaobg=$(".firstThreeValuesBs").css("background-color");
        cssObj.Color.hezhidaxiaofc=$(".firstThreeValuesBs").css("color");
        cssObj.Color.qianzhibg=$(".firstThreeValues").css("background-color");
        cssObj.Color.qianzhifc=$(".firstThreeValues").css("color");
        cssObj.Color.hezhidanshuangbg=$(".andValueSd").css("background-color");
        cssObj.Color.hezhidanshuangfc=$(".andValueSd").css("color");
        cssObj.Color.hezhibg=$(".andValueAll").css("background-color");
        cssObj.Color.hezhifc=$(".andValueAll").css("color");
        cssObj.Color.jishubg=$(".Odd").css("background-color");
        cssObj.Color.jishufc=$(".Odd").css("color");
        cssObj.Color.dashubg=$(".bigNum").css("background-color");
        cssObj.Color.dashufc=$(".bigNum").css("color");
        cssObj.Color.qianchongbg=$(".theFormer").css("background-color");
        cssObj.Color.qianchongfc=$(".theFormer").css("color");
        cssObj.Color.qianchonglianxianbg=$(".theFormerLine").css("background-color");
        cssObj.Color.qianchonglianxianfc=$(".theFormerLine").css("color");
        cssObj.Color.chonghaobg=$(".heavyNumber").css("background-color");
        cssObj.Color.chonghaofc=$(".heavyNumber").css("color");
        cssObj.Color.chonghaolianxianbg=$(".heavyNumberLine").css("background-color");
        cssObj.Color.chonghaolianxianfc=$(".heavyNumberLine").css("color");
        cssObj.Color.qiansanzufenbubg=$(".threeGroupsDis").css("background-color");
        cssObj.Color.qiansanzufenbufc=$(".threeGroupsDis").css("color");
        cssObj.Color.kuadubg=$(".spanDataTable").css("background-color");
        cssObj.Color.kuadufc=$(".spanDataTable").css("color");
        cssObj.Color.kuadulianxianbg=$(".spanDataTableLine").css("background-color");
        cssObj.Color.kuadulianxianfc=$(".spanDataTableLine").css("color");
        cssObj.Color.qiankuabg=$(".beforeCross").css("background-color");
        cssObj.Color.qiankuafc=$(".beforeCross").css("color");
        cssObj.Color.qiankualianxianbg=$(".beforeCrossLine").css("background-color");
        cssObj.Color.qiankualianxianfc=$(".beforeCrossLine").css("color");

        cssObj.zitisheG=0
    }else if(index==1){//红黑
        cssObj.zitisheG=1;
        $(".optionalDis").css("color","#ffffff");
        $(".lotteryNumber").css("color","#000");
        $(".attentionNumRed").css("color","#E10601");
        $(".heavyNumber").css("color","#000");
        $(".Odd").css("color","#E10601");
        $(".bigNum").css("color","#000");

        $(".firstThreeTails").css("color","#000");
        $(".firstThreeValuesBs").css("color","#E10601");
        $(".firstThreeValues").css("color","#E10601");
        $(".andValueSd").css("color","#000");
        $(".andValueAll").css("color","#E10601");
        $(".threeLotteryNumber").css("color","#000");
        $(".threeGroupsDis").css("color","#000");
        $(".heavyNumberLine").css("color","#E10601");

        $(".theFormerLine").css("color","#E10601");
        $(".theFormer").css("color","#E10601");
        $(".beforeCrossLine").css("color","#000");
        $(".spanDataTableLine").css("color","#000");
        $(".spanDataTable").css("color","#E10601");
        $(".beforeCross").css("color","#E10601");

        cssObj.Color.qihaobg=$(".issue").css("background-color");
        cssObj.Color.qihaofc=$(".issue").css("color");
        cssObj.Color.wuweikaijianghaobg=$(".lotteryNumber").css("background-color");
        cssObj.Color.wuweikaijianghaofc=$(".lotteryNumber").css("color");
        cssObj.Color.renxuanfenbubg=$(".lotteryNumber").css("background-color");
        cssObj.Color.renxuanfenbufc=$(".lotteryNumber").css("color");
        cssObj.Color.qiansanweilianxianbg=$(".firstCon").css("background-color");
        cssObj.Color.qiansanweilianxianfc=$(".firstCon").css("color");
        cssObj.Color.guanzhuhaomabg=$(".attentionNum").css("background-color");
        cssObj.Color.guanzhuhaomafc=$(".attentionNum").css("color");
        cssObj.Color.sanweikaijianghaobg=$(".threeLotteryNumber").css("background-color");
        cssObj.Color.sanweikaijianghaofc=$(".threeLotteryNumber").css("color");
        cssObj.Color.qiansanheweilianxianbg=$(".firstThreeTails").css("background-color");
        cssObj.Color.qiansanheweilianxianfc=$(".firstThreeTails").css("color");
        cssObj.Color.hezhidaxiaobg=$(".firstThreeValuesBs").css("background-color");
        cssObj.Color.hezhidaxiaofc=$(".firstThreeValuesBs").css("color");
        cssObj.Color.qianzhibg=$(".firstThreeValues").css("background-color");
        cssObj.Color.qianzhifc=$(".firstThreeValues").css("color");
        cssObj.Color.hezhidanshuangbg=$(".andValueSd").css("background-color");
        cssObj.Color.hezhidanshuangfc=$(".andValueSd").css("color");
        cssObj.Color.hezhibg=$(".andValueAll").css("background-color");
        cssObj.Color.hezhifc=$(".andValueAll").css("color");
        cssObj.Color.jishubg=$(".Odd").css("background-color");
        cssObj.Color.jishufc=$(".Odd").css("color");
        cssObj.Color.dashubg=$(".bigNum").css("background-color");
        cssObj.Color.dashufc=$(".bigNum").css("color");
        cssObj.Color.qianchongbg=$(".theFormer").css("background-color");
        cssObj.Color.qianchongfc=$(".theFormer").css("color");
        cssObj.Color.qianchonglianxianbg=$(".theFormerLine").css("background-color");
        cssObj.Color.qianchonglianxianfc=$(".theFormerLine").css("color");
        cssObj.Color.chonghaobg=$(".heavyNumber").css("background-color");
        cssObj.Color.chonghaofc=$(".heavyNumber").css("color");
        cssObj.Color.chonghaolianxianbg=$(".heavyNumberLine").css("background-color");
        cssObj.Color.chonghaolianxianfc=$(".heavyNumberLine").css("color");
        cssObj.Color.qiansanzufenbubg=$(".threeGroupsDis").css("background-color");
        cssObj.Color.qiansanzufenbufc=$(".threeGroupsDis").css("color");
        cssObj.Color.kuadubg=$(".spanDataTable").css("background-color");
        cssObj.Color.kuadufc=$(".spanDataTable").css("color");
        cssObj.Color.kuadulianxianbg=$(".spanDataTableLine").css("background-color");
        cssObj.Color.kuadulianxianfc=$(".spanDataTableLine").css("color");
        cssObj.Color.qiankuabg=$(".beforeCross").css("background-color");
        cssObj.Color.qiankuafc=$(".beforeCross").css("color");
        cssObj.Color.qiankualianxianbg=$(".beforeCrossLine").css("background-color");
        cssObj.Color.qiankualianxianfc=$(".beforeCrossLine").css("color");

        cssObj.zitisheG=1
    }else if(index==2){//黑绿
        cssObj.zitisheG=2;
        $(".optionalDis").css("color","#ffffff");
        $(".lotteryNumber").css("color","#006464");
        $(".attentionNumRed").css("color","red");
        $(".heavyNumber").css("color","#000");
        $(".Odd").css("color","#006464");
        $(".bigNum").css("color","#000");

        $(".firstThreeTails").css("color","#000");
        $(".firstThreeValuesBs").css("color","#006464");
        $(".firstThreeValues").css("color","#006464");
        $(".andValueSd").css("color","#000");
        $(".andValueAll").css("color","#006464");
        $(".threeLotteryNumber").css("color","#000");
        $(".threeGroupsDis").css("color","#000");
        $(".heavyNumberLine").css("color","#006464");

        $(".theFormerLine").css("color","#006464");
        $(".theFormer").css("color","#006464");
        $(".beforeCrossLine").css("color","#000");
        $(".spanDataTableLine").css("color","#000");
        $(".spanDataTable").css("color","#006464");
        $(".beforeCross").css("color","#006464");

        cssObj.Color.qihaobg=$(".issue").css("background-color");
        cssObj.Color.qihaofc=$(".issue").css("color");
        cssObj.Color.wuweikaijianghaobg=$(".lotteryNumber").css("background-color");
        cssObj.Color.wuweikaijianghaofc=$(".lotteryNumber").css("color");
        cssObj.Color.renxuanfenbubg=$(".lotteryNumber").css("background-color");
        cssObj.Color.renxuanfenbufc=$(".lotteryNumber").css("color");
        cssObj.Color.qiansanweilianxianbg=$(".firstCon").css("background-color");
        cssObj.Color.qiansanweilianxianfc=$(".firstCon").css("color");
        cssObj.Color.guanzhuhaomabg=$(".attentionNum").css("background-color");
        cssObj.Color.guanzhuhaomafc=$(".attentionNum").css("color");
        cssObj.Color.sanweikaijianghaobg=$(".threeLotteryNumber").css("background-color");
        cssObj.Color.sanweikaijianghaofc=$(".threeLotteryNumber").css("color");
        cssObj.Color.qiansanheweilianxianbg=$(".firstThreeTails").css("background-color");
        cssObj.Color.qiansanheweilianxianfc=$(".firstThreeTails").css("color");
        cssObj.Color.hezhidaxiaobg=$(".firstThreeValuesBs").css("background-color");
        cssObj.Color.hezhidaxiaofc=$(".firstThreeValuesBs").css("color");
        cssObj.Color.qianzhibg=$(".firstThreeValues").css("background-color");
        cssObj.Color.qianzhifc=$(".firstThreeValues").css("color");
        cssObj.Color.hezhidanshuangbg=$(".andValueSd").css("background-color");
        cssObj.Color.hezhidanshuangfc=$(".andValueSd").css("color");
        cssObj.Color.hezhibg=$(".andValueAll").css("background-color");
        cssObj.Color.hezhifc=$(".andValueAll").css("color");
        cssObj.Color.jishubg=$(".Odd").css("background-color");
        cssObj.Color.jishufc=$(".Odd").css("color");
        cssObj.Color.dashubg=$(".bigNum").css("background-color");
        cssObj.Color.dashufc=$(".bigNum").css("color");
        cssObj.Color.qianchongbg=$(".theFormer").css("background-color");
        cssObj.Color.qianchongfc=$(".theFormer").css("color");
        cssObj.Color.qianchonglianxianbg=$(".theFormerLine").css("background-color");
        cssObj.Color.qianchonglianxianfc=$(".theFormerLine").css("color");
        cssObj.Color.chonghaobg=$(".heavyNumber").css("background-color");
        cssObj.Color.chonghaofc=$(".heavyNumber").css("background-color");
        cssObj.Color.chonghaolianxianbg=$(".heavyNumberLine").css("background-color");
        cssObj.Color.chonghaolianxianfc=$(".heavyNumberLine").css("color");
        cssObj.Color.qiansanzufenbubg=$(".threeGroupsDis").css("background-color");
        cssObj.Color.qiansanzufenbufc=$(".threeGroupsDis").css("color");
        cssObj.Color.kuadubg=$(".spanDataTable").css("background-color");
        cssObj.Color.kuadufc=$(".spanDataTable").css("color");
        cssObj.Color.kuadulianxianbg=$(".spanDataTableLine").css("background-color");
        cssObj.Color.kuadulianxianfc=$(".spanDataTableLine").css("color");
        cssObj.Color.qiankuabg=$(".beforeCross").css("background-color");
        cssObj.Color.qiankuafc=$(".beforeCross").css("color");
        cssObj.Color.qiankualianxianbg=$(".beforeCrossLine").css("background-color");
        cssObj.Color.qiankualianxianfc=$(".beforeCrossLine").css("color");

        cssObj.zitisheG=2
    }
    changeSetting()
});
$(".liStyle2").click(function () {
    var index=$(this).index();
    $(".content23").eq(1).html($(".liStyle2").eq(index).html());
    if(index==0){//界面1
        cssObj.jiemian=0;
        $(".optionalDis").show();
        $(".firstCon").show();
        $(".secondCon").show();
        $(".thirdCon").show();
        $(".attentionNum").show();
        $(".heavyNumber").show();
        $(".Odd").show();
        $(".bigNum").show();

        $(".firstThreeTails").hide();
        $(".firstThreeValuesBs").hide();
        $(".firstThreeValues").hide();
        $(".andValueSd").hide();
        $(".andValueAll").hide();
        $(".threeLotteryNumber").hide();
        $(".threeGroupsDis").hide();
        $(".heavyNumberLine").hide();

        $(".theFormerLine").hide();
        $(".theFormer").hide();
        $(".beforeCrossLine").hide();
        $(".spanDataTableLine").hide();
        $(".spanDataTable").hide();
        $(".beforeCross").hide();

        cssObj.show={
            renxuanfenbu:true,
            qiansanweilianxian:false,
            guanzhuhaoma:true,
            sanweikaijianghao:true,
            chonghao:false,
            qianheweilianxian:false,
            hezhidaxiao:false,
            qianzhi:false,
            hezhidanshuang:true,
            hezhi:true,
            jishu:false,
            dashu:false,
            qianchong:true,
            qianchonglianxian:false,
            chonghaolianxian:true,
            qiansanzufenbu:false,
            kuadu:false,
            kuadulianxian:false,
            qiankua:false,
            qiankualianxian:false
        };

    }else if(index==1){//界面2
        cssObj.jiemian=1;
        $(".optionalDis").show();
        $(".firstCon").hide();
        $(".secondCon").hide();
        $(".thirdCon").hide();
        $(".attentionNum").show();
        $(".heavyNumber").hide();
        $(".Odd").show();
        $(".bigNum").show();

        $(".firstThreeTails").hide();
        $(".firstThreeValuesBs").hide();
        $(".firstThreeValues").hide();
        $(".andValueSd").hide();
        $(".andValueAll").hide();
        $(".threeLotteryNumber").hide();
        $(".threeGroupsDis").show();
        $(".heavyNumberLine").hide();

        $(".theFormerLine").hide();
        $(".theFormer").hide();
        $(".beforeCrossLine").hide();
        $(".spanDataTableLine").hide();
        $(".spanDataTable").hide();
        $(".beforeCross").hide();
        cssObj.show={
            renxuanfenbu:true,
            qiansanweilianxian:false,
            guanzhuhaoma:true,
            sanweikaijianghao:false,
            chonghao:false,
            qianheweilianxian:false,
            hezhidaxiao:false,
            qianzhi:false,
            hezhidanshuang:false,
            hezhi:false,
            jishu:true,
            dashu:true,
            qianchong:false,
            qianchonglianxian:false,
            chonghaolianxian:false,
            qiansanzufenbu:true,
            kuadu:false,
            kuadulianxian:false,
            qiankua:false,
            qiankualianxian:false
        };


    }else if(index==2){//界面3
        cssObj.jiemian=2;
        $(".optionalDis").show();
        $(".firstCon").hide();
        $(".secondCon").hide();
        $(".thirdCon").hide();
        $(".attentionNum").show();
        $(".heavyNumber").show();
        $(".Odd").hide();
        $(".bigNum").hide();

        $(".firstThreeTails").hide();
        $(".firstThreeValuesBs").hide();
        $(".firstThreeValues").hide();
        $(".andValueSd").show();
        $(".andValueAll").show();
        $(".threeLotteryNumber").show();
        $(".threeGroupsDis").hide();
        $(".heavyNumberLine").show();

        $(".theFormerLine").hide();
        $(".theFormer").hide();
        $(".beforeCrossLine").hide();
        $(".spanDataTableLine").hide();
        $(".spanDataTable").hide();
        $(".beforeCross").hide();
        cssObj.show={
            renxuanfenbu:true,
            qiansanweilianxian:false,
            guanzhuhaoma:true,
            sanweikaijianghao:true,
            chonghao:false,
            qianheweilianxian:false,
            hezhidaxiao:false,
            qianzhi:false,
            hezhidanshuang:true,
            hezhi:true,
            jishu:false,
            dashu:false,
            qianchong:true,
            qianchonglianxian:false,
            chonghaolianxian:true,
            qiansanzufenbu:false,
            kuadu:false,
            kuadulianxian:false,
            qiankua:false,
            qiankualianxian:false
        };

    }
    if($(window).width()>1080){
        topHengDivHeight = $("#topHengDiv").height();
        $("#qihao table tr th").height(topHengDivHeight-3+"px");
    }

    jiemian1();
    changeSetting();
    $(".dataTable tbody").children("*").remove();
    ClassIndex2();
    ordermuban();
    $(".statisticsRow td").css("color","#000")

});
$(".liStyle3").click(function () {
    var index=$(this).index();
    $(".content23").eq(2).html($(".liStyle3").eq(index).html());
    if(index==0){//字体1
        cssObj.ziti=0;
        $(".dataTable").css("font-family","IskoolaPota");

        $(".dataTable").css("font-size","15px");
        $(".shuzhifang table tbody tr td").css("font-size","15px");
        size=20;

        fontFamily="IskoolaPota";
        svg(svgObj);
    }else if(index==1){//字体2
        cssObj.ziti=1;
        $(".dataTable").css("font-family","ZT02");

        $(".dataTable").css("font-size","12px");
        $(".shuzhifang table tbody tr td").css("font-size","12px");
        size=15;
        fontFamily="ZT02";
        svg(svgObj);
    }else if(index==2){//字体3
        cssObj.ziti=2;
        $(".dataTable").css("font-family","ZT05");

        $(".dataTable").css("font-size","14px");
        $(".shuzhifang table tbody tr td").css("font-size","14px");
        size=20;

        fontFamily="ZT05";
        svg(svgObj);
    }
    backgroundSize()
    changeSetting();

});
$(".liStyle4").click(function (){
    var index=$(this).index();
    $(".content23").eq(3).html($(".liStyle4").eq(index).html());
    var asd=$(".liStyle4").eq($(this).index()).html();
    limit1=asd.substr(0,2);
    localStorage.setItem("limit",limit1);
    cssObj.qishu=asd.substr(0,2);
    $(".dataTable tbody").children("*").remove();
    changeSetting();
    windowOnLoad();

});
/*选项结束*/
$(".optionsBtn").click(function () {
    $(".rehao").css("background-color","#f60");
    $(".lenghao").css("background-color","#63cb75");
});
jiemian1();
var fontFamily;
//界面初始加载所存在的情况
function jiemian1() {
    $(".InterfaceColor li").eq(0).css("background-color","#6FC2EE");
    $(".CannotBeCancelled").eq(0).css("display","inline-block");


    $(".InterfaceColor li").eq(1).css("background-color","#6FC2EE");
    $(".CannotBeCancelled").eq(1).css("display","inline-block");


    if(!$("#HengDiv .optionalDis").eq(0).is(":hidden")){

        $(".InterfaceColor li").eq(2).css("background-color","#6FC2EE");
        $(".CannotBeCancelled").eq(2).css("display","inline-block");

    }else{
        $(".InterfaceColor li").eq(2).css("background-color","#F0F0F0");
        $(".CannotBeCancelled").eq(2).css("display","none");
    }


    if(!$("#HengDiv .firstCon").eq(0).is(":hidden")){
        $(".InterfaceColor li").eq(3).css("background-color","#6FC2EE");
        $(".CannotBeCancelled").eq(3).css("display","inline-block");

    }else{
        $(".InterfaceColor li").eq(3).css("background-color","#F0F0F0");
        $(".CannotBeCancelled").eq(3).css("display","none");
    }



    if(!$("#HengDiv .attentionNum").eq(0).is(":hidden")){
        $(".InterfaceColor li").eq(4).css("background-color","#6FC2EE");
        $(".CannotBeCancelled").eq(4).css("display","inline-block");

    }else{
        $(".InterfaceColor li").eq(4).css("background-color","#F0F0F0");
        $(".CannotBeCancelled").eq(4).css("display","none");
    }
    if(!$("#HengDiv .threeLotteryNumber").eq(0).is(":hidden")){
        $(".InterfaceColor li").eq(5).css("background-color","#6FC2EE");
        $(".CannotBeCancelled").eq(5).css("display","inline-block");

    }else{
        $(".InterfaceColor li").eq(5).css("background-color","#F0F0F0");
        $(".CannotBeCancelled").eq(5).css("display","none");
    }
    if(!$("#HengDiv .heavyNumber").eq(0).is(":hidden")){
        $(".InterfaceColor li").eq(6).css("background-color","#6FC2EE");
        $(".CannotBeCancelled").eq(6).css("display","inline-block");

    }else{
        $(".InterfaceColor li").eq(6).css("background-color","#F0F0F0");
        $(".CannotBeCancelled").eq(6).css("display","none");
    }
    if(!$("#HengDiv .firstThreeTails").eq(0).is(":hidden")){
        $(".InterfaceColor li").eq(7).css("background-color","#6FC2EE");
        $(".CannotBeCancelled").eq(7).css("display","inline-block");

    }else{
        $(".InterfaceColor li").eq(7).css("background-color","#F0F0F0");
        $(".CannotBeCancelled").eq(7).css("display","none");
    }
    if(!$("#HengDiv .firstThreeValuesBs").eq(0).is(":hidden")){
        $(".InterfaceColor li").eq(8).css("background-color","#6FC2EE");
        $(".CannotBeCancelled").eq(8).css("display","inline-block");

    }else{
        $(".InterfaceColor li").eq(8).css("background-color","#F0F0F0");
        $(".CannotBeCancelled").eq(8).css("display","none");
    }
    if(!$("#HengDiv .firstThreeValues").eq(0).is(":hidden")){
        $(".InterfaceColor li").eq(9).css("background-color","#6FC2EE");
        $(".CannotBeCancelled").eq(9).css("display","inline-block");

    }else{
        $(".InterfaceColor li").eq(9).css("background-color","#F0F0F0");
        $(".CannotBeCancelled").eq(9).css("display","none");
    }
    if(!$("#HengDiv .andValueSd").eq(0).is(":hidden")){
        $(".InterfaceColor li").eq(10).css("background-color","#6FC2EE");
        $(".CannotBeCancelled").eq(10).css("display","inline-block");

    }else{
        $(".InterfaceColor li").eq(10).css("background-color","#F0F0F0");
        $(".CannotBeCancelled").eq(10).css("display","none");
    }
    if(!$("#HengDiv .andValueAll").eq(0).is(":hidden")){
        $(".InterfaceColor li").eq(11).css("background-color","#6FC2EE");
        $(".CannotBeCancelled").eq(11).css("display","inline-block");

    }else{
        $(".InterfaceColor li").eq(11).css("background-color","#F0F0F0");
        $(".CannotBeCancelled").eq(11).css("display","none");
    }
    if(!$("#HengDiv .Odd").eq(0).is(":hidden")){
        $(".InterfaceColor li").eq(12).css("background-color","#6FC2EE");
        $(".CannotBeCancelled").eq(12).css("display","inline-block");

    }else{
        $(".InterfaceColor li").eq(12).css("background-color","#F0F0F0");
        $(".CannotBeCancelled").eq(12).css("display","none");
    }
    if(!$("#HengDiv .bigNum").eq(0).is(":hidden")){
        $(".InterfaceColor li").eq(13).css("background-color","#6FC2EE");
        $(".CannotBeCancelled").eq(13).css("display","inline-block");

    }else{
        $(".InterfaceColor li").eq(13).css("background-color","#F0F0F0");
        $(".CannotBeCancelled").eq(13).css("display","none");
    }
    if(!$("#HengDiv .theFormer").eq(0).is(":hidden")){
        $(".InterfaceColor li").eq(14).css("background-color","#6FC2EE");
        $(".CannotBeCancelled").eq(14).css("display","inline-block");

    }else{
        $(".InterfaceColor li").eq(14).css("background-color","#F0F0F0");
        $(".CannotBeCancelled").eq(14).css("display","none");
    }
    if(!$("#HengDiv .theFormerLine").eq(0).is(":hidden")){
        $(".InterfaceColor li").eq(15).css("background-color","#6FC2EE");
        $(".CannotBeCancelled").eq(15).css("display","inline-block");

    }else{
        $(".InterfaceColor li").eq(15).css("background-color","#F0F0F0");
        $(".CannotBeCancelled").eq(15).css("display","none");
    }
    if(!$("#HengDiv .heavyNumberLine").eq(0).is(":hidden")){
        $(".InterfaceColor li").eq(16).css("background-color","#6FC2EE");
        $(".CannotBeCancelled").eq(16).css("display","inline-block");

    }else{
        $(".InterfaceColor li").eq(16).css("background-color","#F0F0F0");
        $(".CannotBeCancelled").eq(16).css("display","none");
    }
    if(!$("#HengDiv .threeGroupsDis").eq(0).is(":hidden")){
        $(".InterfaceColor li").eq(17).css("background-color","#6FC2EE");
        $(".CannotBeCancelled").eq(17).css("display","inline-block");

    }else{
        $(".InterfaceColor li").eq(17).css("background-color","#F0F0F0");
        $(".CannotBeCancelled").eq(17).css("display","none");
    }
    if(!$("#HengDiv .spanDataTable").eq(0).is(":hidden")){
        $(".InterfaceColor li").eq(18).css("background-color","#6FC2EE");
        $(".CannotBeCancelled").eq(18).css("display","inline-block");

    }else{
        $(".InterfaceColor li").eq(18).css("background-color","#F0F0F0");
        $(".CannotBeCancelled").eq(18).css("display","none");
    }
    if(!$("#HengDiv .spanDataTableLine").eq(0).is(":hidden")){
        $(".InterfaceColor li").eq(19).css("background-color","#6FC2EE");
        $(".CannotBeCancelled").eq(19).css("display","inline-block");

    }else{
        $(".InterfaceColor li").eq(19).css("background-color","#F0F0F0");
        $(".CannotBeCancelled").eq(19).css("display","none");
    }
    if(!$("#HengDiv .beforeCross").eq(0).is(":hidden")){
        $(".InterfaceColor li").eq(20).css("background-color","#6FC2EE");
        $(".CannotBeCancelled").eq(20).css("display","inline-block");
    }else{
        $(".InterfaceColor li").eq(20).css("background-color","#F0F0F0");
        $(".CannotBeCancelled").eq(20).css("display","none");
    }
    if(!$("#HengDiv .beforeCrossLine").eq(0).is(":hidden")){
        $(".InterfaceColor li").eq(21).css("background-color","#6FC2EE");
        $(".CannotBeCancelled").eq(21).css("display","inline-block");
    }else{
        $(".InterfaceColor li").eq(21).css("background-color","#F0F0F0");
        $(".CannotBeCancelled").eq(21).css("display","none");
    }



    //initPos();
    //$("#HengDiv>.attentionNum").css("width","60px");
}
//增加列！！！大分辨率下单次点击
function oneClick(){
    //增加列！！！
    $(".InterfaceColor li").eq(2).click(function () {
        zengjialie("optionalDis",2);
    });
//前三位连线
    $(".InterfaceColor li").eq(3).click(function () {
        if ($(".CannotBeCancelled").eq(3).is(":hidden")) {
            $(".CannotBeCancelled").eq(3).show();
            $(".InterfaceColor li").eq(3).css("background", "#6fc2ee");

            var firstCon = $("#templateTable .templateTr").children(".firstCon").remove();
            var firstConLast = $("#templateTable .templateTrLast").children(".firstCon").remove();
            var secondCon = $("#templateTable .templateTr").children(".secondCon").remove();
            var secondConLast = $("#templateTable .templateTrLast").children(".secondCon").remove();
            var thirdCon = $("#templateTable .templateTr").children(".thirdCon").remove();
            var thirdConLast = $("#templateTable .templateTrLast").children(".thirdCon").remove();
            $(".dataTable tbody").children("*").remove();

            $("#templateTable .templateTr").append(firstCon);
            $("#templateTable .templateTrLast").append(firstConLast);
            $("#templateTable .templateTr").append(secondCon);
            $("#templateTable .templateTrLast").append(secondConLast);
            $("#templateTable .templateTr").append(thirdCon);
            $("#templateTable .templateTrLast").append(thirdConLast);
            var right=$("#HengDiv .firstCon").remove();
            var right1=$("#HengDiv1 .firstCon").remove();
            $("#HengDiv").append(right);
            $("#HengDiv1").append(right1);

            var right=$("#HengDiv .secondCon").remove();
            var right1=$("#HengDiv1 .secondCon").remove();
            $("#HengDiv").append(right);
            $("#HengDiv1").append(right1);

            var right=$("#HengDiv .thirdCon").remove();
            var right1=$("#HengDiv1 .thirdCon").remove();
            $("#HengDiv").append(right);
            $("#HengDiv1").append(right1);

            $(".firstCon").show();
            $(".secondCon").show();
            $(".thirdCon").show();

            windowOnLoad();
            cssObj.show.qiansanweilianxian=true;
        }else {
            $(".firstCon").hide();
            $(".secondCon").hide();
            $(".thirdCon").hide();

            $(".InterfaceColor li").eq(3).css("background", "#f0f0f0");
            $(".CannotBeCancelled").eq(3).hide();
            svg(svgObj);
            cssObj.show.qiansanweilianxian=false;
        }
        changeSetting();
    });
//关注号码
    $(".InterfaceColor li").eq(4).click(function () {
        zengjialie("attentionNum",4);
    });
//3位开奖号
    $(".InterfaceColor li").eq(5).click(function () {
        zengjialie("threeLotteryNumber",5);
    });
//重号
    $(".InterfaceColor li").eq(6).click(function () {
        zengjialie("heavyNumber",6);
    });
//前和尾连线
    $(".InterfaceColor li").eq(7).click(function () {
        zengjialie("firstThreeTails",7);
    });
//和值大小
    $(".InterfaceColor li").eq(8).click(function () {
        //zengjialie("firstThreeValuesBs",8);
    });
//前值
    $(".InterfaceColor li").eq(9).click(function () {
        zengjialie("firstThreeValues",9);
    });
//和值单双
    $(".InterfaceColor li").eq(10).click(function () {
        //zengjialie("andValueSd",10);
    });
//和值
    $(".InterfaceColor li").eq(11).click(function () {
        zengjialie("andValueAll",11);
    });
//奇数
    $(".InterfaceColor li").eq(12).click(function () {
        zengjialie("Odd",12);
    });
//大数
    $(".InterfaceColor li").eq(13).click(function () {
        zengjialie("bigNum",13);
    });
//前重
    $(".InterfaceColor li").eq(14).click(function () {
        zengjialie("theFormer",14);
    });
//前重连线
    $(".InterfaceColor li").eq(15).click(function () {
        zengjialie("theFormerLine",15);
    });
//重号连线
    $(".InterfaceColor li").eq(16).click(function () {
        zengjialie("heavyNumberLine",16);
    });
//前三组分布
    $(".InterfaceColor li").eq(17).click(function () {
        zengjialie("threeGroupsDis",17);
    });
//跨度
    $(".InterfaceColor li").eq(18).click(function () {
        zengjialie("spanDataTable",18);
    });
//跨度连线
    $(".InterfaceColor li").eq(19).click(function () {
        zengjialie("spanDataTableLine",19);
    });
//前跨
    $(".InterfaceColor li").eq(20).click(function () {
        zengjialie("beforeCross",20);
    });
//前跨连线
    $(".InterfaceColor li").eq(21).click(function () {
        zengjialie("beforeCrossLine",21);
    });
    $(".InterfaceColor li").click(function () {
        $(".rehao").css("background-color","#f60");
        $(".lenghao").css("background-color","#63cb75");
        $(".attentionNumRed").css("color","#f00");
        $(".optionalDisRed").css("color","#fff");
        $(".optionalDisBlue").css("color","#fff");
        ClassIndex2();
        cssObj.jiemian=3;
        if($(window).width()>1080){
            topHengDivHeight = $("#topHengDiv").height();
            $("#qihao table tr th").height(topHengDivHeight-3+"px");
        }
        svg(svgObj);
        qihaoshezhi();
        changeSetting();
        quyuanjiance();
        if($(".dataTable tbody tr td").css("font-family")=="ZT02"){
            $(".shuzhifang table tbody tr td").css("font-size","12px")
        }else{
            $(".shuzhifang table tbody tr td").css("font-size","15px")
        }
    })
}
//增加列！！！
function longClick(){
    if($(window).width()>1079){
        oneClick();
    }else{

        for(var i=0;i<20;i++){
            (function () {
                var timeout;
                var movex;
                var movey;
                var z=i;
                var obj = document.getElementsByClassName("InterfaceColor")[0].getElementsByTagName("li")[z+2];
                obj.addEventListener('touchstart', function(event) {
                    var touch = event.targetTouches[0];
                    var obj1=touch.target;
                    if(obj1.value=='背景色'||obj1.value=='字体色'){
                        if(obj1.value=='背景色'){
                            $("#colorInterface").removeClass();
                            $("#colorInterface").show().addClass("colorBg"+parseInt(z+2));
                        }else if(obj1.value=='字体色'){
                            $("#colorInterface").removeClass();
                            $("#colorInterface").show().addClass("colorFc"+parseInt(z+2));
                        }
                    }else{
                        // 如果这个元素的位置内只有一个手指的话
                        if (event.targetTouches.length == 1) {
                            event.preventDefault();// 阻止浏览器默认事件，重要

                            movex=touch.pageX;
                            movey=touch.pageY;
                            timeout=setTimeout(function () {
                                if(z==0){
                                    zengjialie("optionalDis",2);
                                    var closeOrOpen=$(".optionsBtn img").eq(1).attr("src");
                                    if(closeOrOpen=='img/close.png'){

                                        $(".optionsBtn img").eq(1).attr("src","img/open.png");
                                        $(".optionsBtn img").eq(2).attr("src","img/close.png");
                                        $(".optionsBtn img").eq(3).attr("src","img/close.png");
                                        $(".optionalDisRed").css("background-image","url()");
                                        $(".optionalDisBlue").css("background-image","url()");
                                        $(".optionalDisBlue").css("color","#fff").css("font-weight","500");
                                        $(".optionalDisRed").css("color","#fff").css("font-weight","500");
                                        cssObj.quyuan=true;
                                        cssObj.qianyiziti=false;
                                        cssObj.qiansanziti=false;

                                    }else{
                                        $(".optionsBtn img").eq(1).attr("src","img/close.png");
                                        $(".optionalDisRed").css("background-image","url(./img/red.png)").css("background-size","18px 21px");
                                        $(".optionalDisBlue").css("background-image","url(./img/blue.png)").css("background-size","18px 21px");

                                        $(".optionsBtn img").eq(2).attr("src","img/close.png");

                                        $(".optionalDisBlue").css("color","#ffffff").css("font-weight","500");
                                        $(".optionalDisRed").css("color","#ffffff").css("font-weight","500");
                                        cssObj.quyuan=false;
                                    }
                                }else if(z==1){
                                    if ($(".CannotBeCancelled").eq(3).css("display")=="none") {
                                        $(".CannotBeCancelled").eq(3).show();
                                        $(".InterfaceColor li").eq(3).css("background", "#6fc2ee");

                                        var firstCon = $("#templateTable .templateTr").children(".firstCon").remove();
                                        var firstConLast = $("#templateTable .templateTrLast").children(".firstCon").remove();
                                        var secondCon = $("#templateTable .templateTr").children(".secondCon").remove();
                                        var secondConLast = $("#templateTable .templateTrLast").children(".secondCon").remove();
                                        var thirdCon = $("#templateTable .templateTr").children(".thirdCon").remove();
                                        var thirdConLast = $("#templateTable .templateTrLast").children(".thirdCon").remove();
                                        $(".dataTable tbody").children("*").remove();

                                        $("#templateTable .templateTr").append(firstCon);
                                        $("#templateTable .templateTrLast").append(firstConLast);
                                        $("#templateTable .templateTr").append(secondCon);
                                        $("#templateTable .templateTrLast").append(secondConLast);
                                        $("#templateTable .templateTr").append(thirdCon);
                                        $("#templateTable .templateTrLast").append(thirdConLast);
                                        var right=$("#HengDiv .firstCon").remove();
                                        var right1=$("#HengDiv1 .firstCon").remove();
                                        $("#HengDiv").append(right);
                                        $("#HengDiv1").append(right1);

                                        var right=$("#HengDiv .secondCon").remove();
                                        var right1=$("#HengDiv1 .secondCon").remove();
                                        $("#HengDiv").append(right);
                                        $("#HengDiv1").append(right1);

                                        var right=$("#HengDiv .thirdCon").remove();
                                        var right1=$("#HengDiv1 .thirdCon").remove();
                                        $("#HengDiv").append(right);
                                        $("#HengDiv1").append(right1);

                                        $(".firstCon").show();
                                        $(".secondCon").show();
                                        $(".thirdCon").show();
                                        ClassIndex2();
                                        windowOnLoad();
                                        cssObj.show.qiansanweilianxian=true;
                                    }else {
                                        $(".firstCon").hide();
                                        $(".secondCon").hide();
                                        $(".thirdCon").hide();

                                        if($(window).width()<1079){
                                            $(".dataTable").width($(".dataTable").width()-20*33+"px");
                                            $("#topHengDiv table").width($("#topHengDiv table").width()-20*33+"px");
                                        }

                                        $(".InterfaceColor li").eq(3).css("background", "#f0f0f0");
                                        $(".CannotBeCancelled").eq(3).hide();
                                        svg(svgObj);
                                        cssObj.show.qiansanweilianxian=false;
                                    }
                                    changeSetting();
                                }else if(z==2){
                                    zengjialie("attentionNum",4);
                                }else if(z==3){
                                    zengjialie("threeLotteryNumber",5);
                                }
                                else if(z==4){
                                    zengjialie("heavyNumber",6);
                                }else if(z==5){
                                    zengjialie("firstThreeTails",7);
                                }else if(z==6){
                                    zengjialie("firstThreeValuesBs",8);
                                }else if(z==7){
                                    zengjialie("firstThreeValues",9);
                                }
                                else if(z==8){
                                    zengjialie("andValueSd",10);
                                }else if(z==9){
                                    zengjialie("andValueAll",11);
                                }else if(z==10){
                                    zengjialie("Odd",12);
                                }else if(z==11){
                                    zengjialie("bigNum",13);
                                }
                                else if(z==12){
                                    zengjialie("theFormer",14);
                                }else if(z==13){
                                    zengjialie("theFormerLine",15);
                                }else if(z==14){
                                    zengjialie("heavyNumberLine",16);
                                }else if(z==15){
                                    zengjialie("threeGroupsDis",17);
                                }
                                else if(z==16){
                                    zengjialie("spanDataTable",18);
                                }else if(z==17){
                                    zengjialie("spanDataTableLine",19);
                                }else if(z==18){
                                    zengjialie("beforeCross",20);
                                }else if(z==19){
                                    zengjialie("beforeCrossLine",21);
                                }
                                $(".rehao").css("background-color","#f60");
                                $(".lenghao").css("background-color","#63cb75");
                                $(".attentionNumRed").css("color","#f00");
                                $(".optionalDisRed").css("color","#fff");
                                $(".optionalDisBlue").css("color","#fff");
                                ClassIndex2();
                                cssObj.jiemian=3;
                                if($(window).width()>1080){
                                    topHengDivHeight = $("#topHengDiv").height();
                                    $("#qihao table tr th").height(topHengDivHeight-3+"px");
                                }
                                qihaoshezhi();
                                changeSetting();
                                quyuanjiance();
                                if($(".dataTable tbody tr td").css("font-family")=="ZT02"){
                                    $(".shuzhifang table tbody tr td").css("font-size","12px")
                                }else{
                                    $(".shuzhifang table tbody tr td").css("font-size","15px")
                                }

                            },800)
                        }
                    }


                }, false);
                obj.addEventListener("touchend",function (event) {
                    clearTimeout(timeout);
                    event.preventDefault();
                });
                obj.addEventListener("touchmove",function(event){
                    var touch = event.targetTouches[0];
                    if(Math.abs(movex-touch.pageX)>=50||Math.abs(movey-touch.pageY)>=50){
                        clearTimeout(timeout);
                    }
                    event.preventDefault();
                })
            })()

        }
    }
}

function zengjialie(class1,index){
    if($(".CannotBeCancelled").eq(index).css("display")=="none"){
        $(".CannotBeCancelled").eq(index).show();
        $(".InterfaceColor li").eq(index).css("background","#6fc2ee");
        var optionalDis = $("#templateTable .templateTr").children("."+class1).remove();
        var optionalDisLast = $("#templateTable .templateTrLast").children("."+class1).remove();
        var right=$("#HengDiv ."+class1).remove();
        var right1=$("#HengDiv1 ."+class1).remove();
        $(".dataTable tbody").children("*").remove();
        if(class1 =="optionalDis"){
            var numClassIndex2 = JSON.parse(localStorage.getItem("ClassIndex2"));
            numClassIndex2.optionalDis= true;
            localStorage.setItem("ClassIndex2",JSON.stringify(numClassIndex2));
        }
        $("#templateTable .templateTr").append(optionalDis);
        $("#templateTable .templateTrLast").append(optionalDisLast);
        $("#HengDiv").append(right);
        $("#HengDiv1").append(right1);
        $("."+class1).show();
        cssObj.show.renxuanfenbu=true;
        windowOnLoad();
    }else{
        $(".InterfaceColor li").eq(index).css("background","#f0f0f0");
        $(".CannotBeCancelled").eq(index).hide();

        var optionalDis = $("#templateTable .templateTr").children("."+class1);

        if($(window).width()<1079){
            $(".dataTable").width($(".dataTable").width()-20*optionalDis.length+"px");
            $("#topHengDiv table").width($("#topHengDiv table").width()-20*optionalDis.length+"px");
        }

        $("."+class1).hide();
        svg(svgObj);
        cssObj.show.renxuanfenbu=false;
    }
    changeSetting();
}


/*
 //IE兼容性处理
 $(function () {

 //ie?
 if (!!window.ActiveXObject || "ActiveXObject" in window){
 //是
 $(".CannotBeCancelled").html("IE暂不支持");
 $(".bgColor12").css("display","none");
 $(".color").css("display","none");
 $(".color1").css("display","none");
 $(".fontColor12").css("display","none");
 //"部分功能不能被IE内核浏览器兼容，请谨慎使用")

 }else{
 //不是

 }

 });*/
Array.prototype.clone=function(){
    var a=[];
    for(var i=0,l=this.length;i<l;i++){
        a.push(this[i]);
    }
    return a;
};
Array.prototype.bubbleSort = function(){
    for(var i=0;i<this.length-1;i++){
        for(var j=i+1;j<this.length;j++){
            //获取第一个值和后一个值比较
            var cur = this[i];
            if(cur>this[j]){
                // 因为需要交换值，所以会把后一个值替换，我们要先保存下来
                var index = this[j];
                // 交换值
                this[j] = cur;
                this[i] = index;
            }
        }
    }
    return this;
};
var limit1=20;
function userInfo() {
    //获取用户设置
    var username=localStorage.getItem("username");
    var token=localStorage.getItem("token");
    if(username&&token){
        $.ajax({
            type: 'POST',
            url: "http://zcai.cn/getUserInfo",
            data: {
                username:username,
                token:token
            },
            async:false,
            success: function (text) {
                if(text.msg==1) {
                    setting(text);
                }else{
                    localStorage.removeItem("username");
                    localStorage.removeItem("token");
                    localStorage.removeItem("outTime");
                    alert("您已在其他地方登陆");
                    windowOnLoad(-1)
                }
            },
            error:function (err) {
                console.log(err);
            }
        });
    }else{
        windowOnLoad(0)
    }
}
//加载用户自定义样式
function setting(text){
    if(text.msg !=0){
        if(text.data[0]["参数"]){
            var canshu=JSON.parse(text.data[0]["参数"]);
            if(canshu.sc12!=null){
                cssObj=canshu.sc12;
                var setting=canshu.sc12;
                //颜色设置
                colorAndBgColor(setting);
                menuSetting(setting);
                ClassIndex2();


            }else{
                windowOnLoad(0);

            }
        }else{
            windowOnLoad(0);
        }
    }
}
function getRecommend() {
    //二码 三码 四码推荐
    $.ajax({
        type: 'POST',
        url: "http://zcai.cn/getRecommend",
        data: {
            type:6
        },
        async:false,
        success: function (res) {
            recommend = res.data;
        },
        error:function (err) {
            alert(err);
        }
    });
}
function getMissing() {
    //遗漏统计
    $.ajax({
        type: 'POST',
        url: "http://zcai.cn/getMissing",
        data: {
            type:6
        },
        async:false,
        success: function (res) {
            missObj = res.data;
        },
        error:function (err) {
            alert(err);
        }
    });
}
function getLottTime(){
    //获取彩票开奖时间
    $.ajax({
        type: 'POST',
        url: "http://zcai.cn//getLotteryTime",
        data: {
            type:6
        },
        async:false,
        success: function (res) {
            lotteryTime = res.data;
            if(res.msg == 1){
                var min = parseInt(lotteryTime.n_time/60);
                var second = lotteryTime.n_time%60;
                lotteryTime.min = min;
                lotteryTime.second = second;
            }else{
                lotteryTime.text = "暂未开售";
            }
        },
        error:function (err) {

        }
    });
}
function ajaxFunction(){
    //获取往期数据

    var limit2=localStorage.getItem("limit");
    if(!limit2){
        limit2=limit1;

    }
    $.ajax({
        type: 'POST',
        url: "http://zcai.cn/getLotteryNum",
        data: {
            type:6,
            limit:limit2
        },
        async:false,
        success: function (res) {
            obj = res.data.reverse();
        },
        error:function (err) {
            console.log(err);
        }
    });
}
function getGameInfo(){
    //获取彩票开奖时间
    $.ajax({
        type: 'GET',
        url: "http://zcai.cn/getGameInfo",
        data:{
            type:6
        },
        async:true,
        success: function (res) {
            if(res.msg == 1){
                $(".headerLeft .spanQq").text("QQ:"+res.data[0].代理QQ);
                $(".headerLeft .spanTel").text("Tel:"+res.data[0].代理Tel);
            }
        },
        error:function (err) {
            console.log(err);
        }
    });
}
//样式更改保存
function changeSetting() {

    var cssObj1=JSON.stringify(cssObj);
    var username=localStorage.getItem("username");
    var token=localStorage.getItem("token");

    if(username&&token){
        $.ajax({
            type: 'POST',
            url: "http://zcai.cn/setUserSetting",
            data: {
                username:username,
                token:token,
                setting:cssObj1,
                game:'sc12'
            },
            success: function (text) {

            },
            error:function (err) {

            }
        });
    }
    $(".statisticsRow td").css("color","#000")
}
//菜单设置
function menuSetting(setting) {

    //界面1 2 3
    if(setting.jiemian==0){//界面1
        cssObj.jiemian=0;
        $(".optionalDis").show();
        $(".firstCon").show();
        $(".secondCon").show();
        $(".thirdCon").show();
        $(".attentionNum").show();
        $(".heavyNumber").show();
        $(".Odd").show();
        $(".bigNum").show();

        $(".firstThreeTails").hide();
        $(".firstThreeValuesBs").hide();
        $(".firstThreeValues").hide();
        $(".andValueSd").hide();
        $(".andValueAll").hide();
        $(".threeLotteryNumber").hide();
        $(".threeGroupsDis").hide();
        $(".heavyNumberLine").hide();

        $(".theFormerLine").hide();
        $(".theFormer").hide();
        $(".beforeCrossLine").hide();
        $(".spanDataTableLine").hide();
        $(".spanDataTable").hide();
        $(".beforeCross").hide();
        $(".content23").eq(1).html("界面1");
        cssObj.show={
            renxuanfenbu:true,
            qiansanweilianxian:false,
            guanzhuhaoma:true,
            sanweikaijianghao:true,
            chonghao:false,
            qianheweilianxian:false,
            hezhidaxiao:false,
            qianzhi:false,
            hezhidanshuang:true,
            hezhi:true,
            jishu:false,
            dashu:false,
            qianchong:true,
            qianchonglianxian:false,
            chonghaolianxian:true,
            qiansanzufenbu:false,
            kuadu:false,
            kuadulianxian:false,
            qiankua:false,
            qiankualianxian:false
        };
        svg(svgObj);
        jiemian1();
    }else if(setting.jiemian==1){//界面2

        cssObj.jiemian=1;
        $(".optionalDis").show();
        $(".firstCon").hide();
        $(".secondCon").hide();
        $(".thirdCon").hide();
        $(".attentionNum").show();
        $(".heavyNumber").hide();
        $(".Odd").show();
        $(".bigNum").show();

        $(".firstThreeTails").hide();
        $(".firstThreeValuesBs").hide();
        $(".firstThreeValues").hide();
        $(".andValueSd").hide();
        $(".andValueAll").hide();
        $(".threeLotteryNumber").hide();
        $(".threeGroupsDis").show();
        $(".heavyNumberLine").hide();

        $(".theFormerLine").hide();
        $(".theFormer").hide();
        $(".beforeCrossLine").hide();
        $(".spanDataTableLine").hide();
        $(".spanDataTable").hide();
        $(".beforeCross").hide();

        $(".content23").eq(1).html("界面2");

        cssObj.show={
            renxuanfenbu:true,
            qiansanweilianxian:false,
            guanzhuhaoma:true,
            sanweikaijianghao:false,
            chonghao:false,
            qianheweilianxian:false,
            hezhidaxiao:false,
            qianzhi:false,
            hezhidanshuang:false,
            hezhi:false,
            jishu:true,
            dashu:true,
            qianchong:false,
            qianchonglianxian:false,
            chonghaolianxian:false,
            qiansanzufenbu:true,
            kuadu:false,
            kuadulianxian:false,
            qiankua:false,
            qiankualianxian:false
        };


    }else if(setting.jiemian==2){//界面3

        cssObj.jiemian=2;
        $(".optionalDis").show();
        $(".firstCon").hide();
        $(".secondCon").hide();
        $(".thirdCon").hide();
        $(".attentionNum").show();
        $(".heavyNumber").show();
        $(".Odd").hide();
        $(".bigNum").hide();

        $(".firstThreeTails").hide();
        $(".firstThreeValuesBs").hide();
        $(".firstThreeValues").hide();
        $(".andValueSd").show();
        $(".andValueAll").show();
        $(".threeLotteryNumber").show();
        $(".threeGroupsDis").hide();
        $(".heavyNumberLine").show();

        $(".theFormerLine").hide();
        $(".theFormer").hide();
        $(".beforeCrossLine").hide();
        $(".spanDataTableLine").hide();
        $(".spanDataTable").hide();
        $(".beforeCross").hide();

        $(".content23").eq(1).html("界面3");
        cssObj.show={
            renxuanfenbu:true,
            qiansanweilianxian:false,
            guanzhuhaoma:true,
            sanweikaijianghao:true,
            chonghao:false,
            qianheweilianxian:false,
            hezhidaxiao:false,
            qianzhi:false,
            hezhidanshuang:true,
            hezhi:true,
            jishu:false,
            dashu:false,
            qianchong:true,
            qianchonglianxian:false,
            chonghaolianxian:true,
            qiansanzufenbu:false,
            kuadu:false,
            kuadulianxian:false,
            qiankua:false,
            qiankualianxian:false
        };

        //svg(svgObj);
        jiemian1();
    }else if(setting.jiemian==3){//此处还需要算法算出来排列先后顺序
        $(".content23").eq(1).html("自定义界面");

        //svg(svgObj);
        jiemian1();
    }

    ordermuban();
    //期数
    if(setting.qishu){

        $(".content23").eq(3).html("期数设置");

    }

    //直播
    if(setting.zhibo){
        $(".optionsBtn img").eq(0).attr("src","img/open.png");
    }else{
        $(".optionsBtn img").eq(0).attr("src","img/close.png");
    }


    //前一字体色
    if(setting.qianyiziti){

        $(".optionalDisBlue").css("color","#ffffff").css("font-weight","500");
        $(".optionalDisRed").css("color","#ffffff").css("font-weight","500");
        $(".optionalDisRed").css("background-image","url(./img/red.png)").css("background-size","18px 21px");
        $(".optionalDisBlue").css("background-image","url(./img/blue.png)").css("background-size","18px 21px");
        $(".optionsBtn img").eq(2).attr("src","img/open.png");
        $(".optionsBtn img").eq(3).attr("src","img/close.png");
        $(".optionsBtn img").eq(1).attr("src","img/close.png");
        $(".optionalDisRed").css("background-image","url(./img/blue.png)").css("background-size","18px 21px");
        //方法
        var first=[];
        for(var i=1;i<$(".dataTable tbody tr").length-1;i++){
            first[i-1]=$(".lotteryNumber").eq(i*5+1).html();
        }
        for(var i=1;i<$(".dataTable tbody tr").length;i++){

            $(".dataTable tbody tr").eq(i-1).find(".optionalDis").eq(first[i-1]-1).css("background-image","url(./img/red.png)").css("background-size","18px 21px");

        }
        cssObj.quyuan=false;
        cssObj.qianyiziti=true;
        cssObj.qiansanziti=false;
    }else{


        $(".optionsBtn img").eq(2).attr("src","img/close.png");
        $(".optionalDisBlue").css("color","#ffffff").css("font-weight","500");
        $(".optionalDisRed").css("color","#ffffff").css("font-weight","500");
        cssObj.qianyiziti=false;
    }

    //前三字体色
    if(setting.qiansanziti){
        $(".optionsBtn img").eq(1).attr("src","img/close.png");
        $(".optionalDisRed").css("background-image","url(./img/red.png)").css("background-size","18px 21px");
        $(".optionalDisBlue").css("background-image","url(./img/blue.png)").css("background-size","18px 21pxx");
        $(".optionsBtn img").eq(3).attr("src","img/open.png");
        $(".optionalDisRed").css("background-image","url(./img/red.png)").css("background-size","18px 21px");
        $(".optionsBtn img").eq(2).attr("src","img/close.png");
        cssObj.qiansanziti=true;
        cssObj.quyuan=false;
        cssObj.qianyiziti=false;
    }else{
        $(".optionsBtn img").eq(3).attr("src","img/close.png");
        $(".optionalDisRed").css("background-image","url(./img/blue.png)").css("background-size","18px 21px");
        $(".optionalDisBlue").css("background-image","url(./img/blue.png)").css("background-size","18px 21px");

        cssObj.qiansanziti=false;
    }
    //连号背景
    if(setting.lianhaobeijing){
        $(".optionsBtn img").eq(4).attr("src","img/open.png");
        cssObj.lianhaobeijing=true;

        $(".optionsBtn img").eq(4).attr("src","img/open.png");
        //连号处理方法
        var arrX=[];
        for(var i=0;i<obj.length;i++){
            arrX[i]=[];
            for(var j=0;j<obj[i].kaijianghao.length;j++){
                arrX[i][j]=obj[i].kaijianghao[j];
            }
            arrX[i]=arrX[i].sort(sortNumber);
        }
        for(var iq=0;iq<arrX.length;iq++){

            var index0= arrX[iq][0];
            var index1= arrX[iq][1];
            var index2= arrX[iq][2];
            var index3= arrX[iq][3];
            var index4= arrX[iq][4];

            if(parseInt(index0)+2==parseInt(index1)+1&&parseInt(index1)+1==index2){
                $(".dataTable tbody tr").eq(iq).find(".optionalDis").eq(index0-1).css("background-color","#f60");
                $(".dataTable tbody tr").eq(iq).find(".optionalDis").eq(index1-1).css("background-color","#f60");
                $(".dataTable tbody tr").eq(iq).find(".optionalDis").eq(index2-1).css("background-color","#f60");
                if(parseInt(index2)+1==index3){
                    $(".dataTable tbody tr").eq(iq).find(".optionalDis").eq(index3-1).css("background-color","#f60");
                }
                if(parseInt(index2)+1==index3&&parseInt(index3)+1==index4){
                    $(".dataTable tbody tr").eq(iq).find(".optionalDis").eq(index4-1).css("background-color","#f60");
                }

            }else if(parseInt(index1)+2==parseInt(index2)+1&&parseInt(index2)+1==index3){
                $(".dataTable tbody tr").eq(iq).find(".optionalDis").eq(index1-1).css("background-color","#f60");
                $(".dataTable tbody tr").eq(iq).find(".optionalDis").eq(index2-1).css("background-color","#f60");
                $(".dataTable tbody tr").eq(iq).find(".optionalDis").eq(index3-1).css("background-color","#f60");
                if(parseInt(index3)+1==index4){
                    $(".dataTable tbody tr").eq(iq).find(".optionalDis").eq(index4-1).css("background-color","#f60");
                }
            }else if(parseInt(index2)+2==parseInt(index3)+1&&parseInt(index3)+1==index4){
                $(".dataTable tbody tr").eq(iq).find(".optionalDis").eq(index2-1).css("background-color","#f60");
                $(".dataTable tbody tr").eq(iq).find(".optionalDis").eq(index3-1).css("background-color","#f60");
                $(".dataTable tbody tr").eq(iq).find(".optionalDis").eq(index4-1).css("background-color","#f60");
            }
            $(".statisticsRow .optionalDis").css("background-color","#00a6a6")
        }

    }else{
        $(".optionsBtn img").eq(4).attr("src","img/close.png");
        cssObj.lianhaobeijing=false;
        $(".optionsBtn img").eq(4).attr("src","img/close.png");

        $(".optionalDis").css("background-color",$(".optionalDis").eq(0).css("background-color"));
        $(".statisticsRow .optionalDis").css("background-color","#00a6a6");


    }
    //去圆
    if(setting.quyuan){

        $(".optionsBtn img").eq(1).attr("src","img/open.png");
        $(".optionsBtn img").eq(2).attr("src","img/close.png");
        $(".optionsBtn img").eq(3).attr("src","img/close.png");
        $(".optionalDisRed").css("background-image","url()");
        $(".optionalDisBlue").css("background-image","url()");
        $(".optionalDisBlue").css("color",$("#HengDiv .optionalDis").css("color")).css("font-weight","500");
        $(".optionalDisRed").css("color",$("#HengDiv .optionalDis").css("color")).css("font-weight","500");

        $(".missVlu").css("color","#999");
        cssObj.quyuan=true;
        cssObj.qianyiziti=false;
        cssObj.qiansanziti=false;

    }else{

        $(".optionsBtn img").eq(1).attr("src","img/close.png");
        $(".optionsBtn img").eq(2).attr("src","img/close.png");
        $(".missVlu").css("color","#999");
        $(".optionalDisBlue").css("color","#fff").css("font-weight","500");
        $(".optionalDisRed").css("color","#fff").css("font-weight","500");
        cssObj.quyuan=false;

    }

    //字体色设置
    if(setting.zitisheG==0){
        $(".content23").eq(0).html('红—紫');
    }else if(setting.zitisheG==1){
        $(".content23").eq(0).html('红—黑');
    }else if(setting.zitisheG==2){
        $(".content23").eq(0).html('黑—绿');
    }



    //字体1 字体2 字体3
    if(setting.ziti==0){
        $(".dataTable").css("font-family","IskoolaPota");
        fontFamily="IskoolaPota";
        $(".content23").eq(2).html("字体1");

        $(".dataTable").css("font-size","15px");
        $(".shuzhifang table tbody tr td").css("font-size","15px");
        size=20;

    }else if(setting.ziti==1){
        $(".dataTable").css("font-family","ZT02");

        $(".dataTable").css("font-size","12px");
        $(".shuzhifang table tbody tr td").css("font-size","12px");
        size=15;

        $(".content23").eq(2).html("字体2");
        fontFamily="ZT02";
    }else if(setting.ziti==2){
        $(".dataTable").css("font-family","ZT05");
        $(".content23").eq(2).html("字体3");
        fontFamily="ZT05";

        $(".dataTable").css("font-size","14px");
        $(".shuzhifang table tbody tr td").css("font-size","14px");
        size=20;


    }

    svg(svgObj);
    $(".statisticsRow .rehao").css("background-color","#f60");
    $(".statisticsRow .lenghao").css("background-color","#63cb75");

    if($(window).height()>1200){
        if (isChrome) {
            $(".optionalDisRed").css("background-size","18px 21px");
            $(".optionalDisBlue").css("background-size","18px 21px");
        }else{
            $(".optionalDisRed").css("background-size","18px 21px");
            $(".optionalDisBlue").css("background-size","18px 21px");
        }
        $(".shuzhifang table tr td").css("fontSize","11px");
    }
    ClassIndex2();
    changeSetting();
    //svg(svgObj);
    backgroundSize();
    jiemian1();
}
//点击变成自定义界面
$(".InterfaceColor li").click(function () {
    ClassIndex2();
    $(".content23").eq(1).html("自定义界面");
    changeSetting();
});
//颜色设置
function colorAndBgColor(setting) {
    //期号
    $(".issueTwo").css("background-color",setting.Color.qihaobg);
    $(".statisticsRowLeft.issueTwo ").css("background-color","#00a6a6").css("color","#000000");
    $("#qihao table tbody tr th").css("background-color",setting.Color.qihaobg).css("color",setting.Color.qihaofc);
    $(".issueTwo").css("color",setting.Color.qihaofc);
    $(".statisticsRowLeft.issueTwo ").css("color","#000000");
    //5位开奖号
    $(".lotteryNumber").css("background-color",setting.Color.wuweikaijianghaobg);
    $(".statisticsRow .lotteryNumber").css("background-color","#00a6a6");
    $(".countDownd").css("background-color",setting.Color.wuweikaijianghaobg);

    $(".lotteryNumber").css("color",setting.Color.wuweikaijianghaofc);
    $(".statisticsRow .lotteryNumber").css("color","#000");
    $(".countDownd").css("color",setting.Color.wuweikaijianghaofc);
    //任选分布
    $(".optionalDis").css("background-color",setting.Color.renxuanfenbubg);
    $(".statisticsRow .optionalDis").css("background-color","#00a6a6");
    $(".optionalDis").css("color",setting.Color.renxuanfenbufc);
    $(".missVlu").css("color","#999999");
    $(".statisticsRow .optionalDis").css("color","#006464");
    $(".statisticsRow .rehao").css("background-color","#f60");
    $(".statisticsRow .lenghao").css("background-color","#63cb75");
    //前三位连线
    $(".firstCon").css("background-color",setting.Color.qiansanweilianxianbg);
    $(".secondCon").css("background-color",setting.Color.qiansanweilianxianbg);
    $(".thirdCon").css("background-color",setting.Color.qiansanweilianxianbg);
    $(".statisticsRow .firstCon").css("background-color","#00a6a6");
    $(".statisticsRow .secondCon").css("background-color","#00a6a6");
    $(".statisticsRow .thirdCon").css("background-color","#00a6a6");
    svgObj[0].bgColor = setting.Color.qiansanweilianxianbg;
    $(".firstCon").css("color",setting.Color.qiansanweilianxianfc);
    $(".secondCon").css("color",setting.Color.qiansanweilianxianfc);
    $(".thirdCon").css("color",setting.Color.qiansanweilianxianfc);
    $(".statisticsRow .firstCon").css("color","#000");
    $(".statisticsRow .secondCon").css("color","#000");
    $(".statisticsRow .thirdCon").css("color","#000");
    svgObj[0].fontColor = setting.Color.qiansanweilianxianfc;
    //关注号码
    $(".attentionNum").css("background-color",setting.Color.guanzhuhaomabg);
    $(".statisticsRow .attentionNum").css("background-color","#00a6a6");
    $(".attentionNum").css("color",setting.Color.guanzhuhaomafc);
    $(".attentionNumRed").css("color","red");
    $(".statisticsRow .attentionNum").css("color","#000");
    //三位开奖号
    $(".threeLotteryNumber").css("background-color",setting.Color.sanweikaijianghaobg);
    $(".statisticsRow .threeLotteryNumber").css("background-color","#00a6a6");
    $(".threeLotteryNumber").css("color",setting.Color.sanweikaijianghaofc);
    $(".statisticsRow .threeLotteryNumber").css("color","#000");
    //重号
    $(".heavyNumber").css("background-color",setting.Color.chonghaobg);
    $(".statisticsRow .heavyNumber").css("background-color","#00a6a6");
    $(".heavyNumber").css("color",setting.Color.chonghaofc);
    $(".statisticsRow .heavyNumber").css("color","#000");
    //前三和尾连线 var colorTails="#F1F1D6"
    $(".firstThreeTails").css("background-color",setting.Color.qiansanheweilianxianbg);
    $(".statisticsRow .firstThreeTails").css("background-color","#00a6a6");
    svgObj[1].bgColor = setting.Color.qiansanheweilianxianbg;
    $(".firstThreeTails").css("color",setting.Color.qiansanheweilianxianfc);
    $(".statisticsRow .firstThreeTails").css("color","#000");
    svgObj[1].fontColor =setting.Color.qiansanheweilianxianfc;
    //和值大小
    /*$(".firstThreeValuesBs").css("background-color",setting.Color.hezhidaxiaobg);
     $(".statisticsRow .firstThreeValuesBs").css("background-color","#00a6a6");
     $(".firstThreeValuesBs").css("color",setting.Color.hezhidaxiaofc);
     $(".statisticsRow .firstThreeValuesBs").css("color","#000");
     */
    //前值
    $(".firstThreeValues").css("background-color",setting.Color.qianzhibg);
    $(".statisticsRow .firstThreeValues").css("background-color","#00a6a6");
    $(".firstThreeValues").css("color",setting.Color.qianzhifc);
    $(".statisticsRow .firstThreeValues").css("color","#000");
    //和值单双
    /*$(".andValueSd").css("background-color",setting.Color.hezhidanshuangbg);
     $(".statisticsRow .andValueSd").css("background-color","#00a6a6");
     $(".andValueSd").css("color",setting.Color.hezhidanshuangfc);
     $(".statisticsRow .andValueSd").css("color","#000");
     */
    //和值
    $(".andValueAll").css("background-color",setting.Color.hezhibg);
    $(".statisticsRow .andValueAll").css("background-color","#00a6a6");
    $(".andValueAll").css("color",setting.Color.hezhifc);
    $(".statisticsRow .andValueAll").css("color","#000");
    //奇数
    $(".Odd").css("background-color",setting.Color.jishubg);
    $(".statisticsRow .Odd").css("background-color","#00a6a6");
    $(".Odd").css("color",setting.Color.jishufc);
    $(".statisticsRow .Odd").css("color","#000");
    //大数
    $(".bigNum").css("background-color",setting.Color.dashubg);
    $(".statisticsRow .bigNum").css("background-color","#00a6a6");
    $(".bigNum").css("color",setting.Color.dashufc);
    $(".statisticsRow .bigNum").css("color","#000");
    //前重
    $(".theFormer").css("background-color",setting.Color.qianchongbg);
    $(".statisticsRow .theFormer").css("background-color","#00a6a6");
    $(".theFormer").css("color",setting.Color.qianchongfc);
    $(".statisticsRow .theFormer").css("color","#000");
    //前重连线 colorFormer="#F1F1D6"
    $(".theFormerLine").css("background-color",setting.Color.qianchonglianxianbg);
    $(".statisticsRow .theFormerLine").css("background-color","#00a6a6");
    svgObj[2].bgColor = setting.Color.qianchonglianxianbg;
    $(".theFormerLine").css("color",setting.Color.qianchonglianxianfc);
    $(".statisticsRow .theFormerLine").css("color","#000");
    svgObj[2].fontColor = setting.Color.qianchonglianxianfc;
    //重号连线
    $(".heavyNumberLine").css("background-color",setting.Color.chonghaolianxianbg);
    $(".statisticsRow .heavyNumberLine").css("background-color","#00a6a6");
    svgObj[3].bgColor = setting.Color.chonghaolianxianbg;
    $(".heavyNumberLine").css("color",setting.Color.chonghaolianxianfc);
    $(".statisticsRow .heavyNumberLine").css("color","#000");
    svgObj[3].fontColor = setting.Color.chonghaolianxianfc;
    //前三组分布
    $(".threeGroupsDis").css("background-color",setting.Color.qiansanzufenbubg);
    $(".statisticsRow .threeGroupsDis").css("background-color","#00a6a6");
    $(".threeGroupsDis").css("color",setting.Color.qiansanzufenbufc);
    $(".statisticsRow .threeGroupsDis").css("color","#000");
    //跨度
    $(".spanDataTable").css("background-color",setting.Color.kuadubg);
    $(".statisticsRow .spanDataTable").css("background-color","#00a6a6");
    $(".spanDataTable").css("color",setting.Color.kuadufc);
    $(".statisticsRow .spanDataTable").css("color","#000");
    //跨度连线 var colorSpan="#dbecc7";//跨度连线
    $(".spanDataTableLine").css("background-color",setting.Color.kuadulianxianbg);
    $(".statisticsRow .spanDataTableLine").css("background-color","#00a6a6");
    svgObj[4].bgColor = setting.Color.kuadulianxianbg;
    $(".spanDataTableLine").css("color",setting.Color.kuadulianxianfc);
    $(".statisticsRow .spanDataTableLine").css("color","#000");
    svgObj[4].fontColor = setting.Color.kuadulianxianfc;
    //前跨
    $(".beforeCross").css("background-color",setting.Color.qiankuabg);
    $(".statisticsRow .beforeCross").css("background-color","#00a6a6");
    $(".beforeCross").css("color",setting.Color.qiankuafc);
    $(".statisticsRow .beforeCross").css("color","#000");
    //前跨连线//var colorCross="#FFD2E9";//前跨连线
    $(".beforeCrossLine").css("background-color",setting.Color.qiankualianxianbg);
    $(".statisticsRow .beforeCrossLine").css("background-color","#00a6a6");
    svgObj[5].bgColor = setting.Color.qiankualianxianbg;
    $(".beforeCrossLine").css("color",setting.Color.qiankualianxianfc);
    $(".statisticsRow .beforeCrossLine").css("color","#000");
    svgObj[5].fontColor =setting.Color.qiankualianxianfc;
    //连线颜色
    svgObj[6].lineColor = setting.Color.lianxian;
    //svg(svgObj);
}
//排序
function sortNumber(a,b) {
    return a - b
}
//获取class顺序
function ClassIndex2() {
    var orderIndex={};
    var len=$("#HengDiv th");
    var className;
    var zz=0;

    for(var zm=1;zm<len.length;zm++){
        className=$("#HengDiv th").eq(zm).attr("class");
        className=className.substring(0,className.length-11);
        orderIndex[className]=!$("."+className).eq(0).is(":hidden");
    }

    orderIndex=JSON.stringify(orderIndex);
    localStorage.setItem("ClassIndex2",orderIndex);
    cssObj.jiemian=3;
}
//根据顺序操作模板
function ordermuban() {
    var orderIndex=localStorage.getItem("ClassIndex2");
    orderIndex=JSON.parse(orderIndex);
    var key;
    for(key in orderIndex){
        if(orderIndex[key]==true){
            $("."+key).show();
        }else{
            $("."+key).hide();
        }
    }
    windowOnLoad();
    if($(window).width()>1080){
        topHengDivHeight = $("#topHengDiv").height();
        $("#qihao table tr th").height(topHengDivHeight-3+"px");
    }
    $(".attentionNumRed").css("color","#f00");
}
function zitiyanse(class1,cssObjColorBgValue,cssObjColorFcValue,className3,val){
    if(className3=="colorBg"){
        $("."+class1).css("background-color",val);
        $(".statisticsRow ."+class1).css("background-color","#00a6a6");
        cssObj.Color[cssObjColorBgValue]=val;


    }else if(className3=="colorFc"){
        $("."+class1).css("color",val);
        $(".statisticsRow ."+class1).css("color","#000");
        cssObj.Color[cssObjColorFcValue]=val;
    }
}
//字体颜色改变

$(function () {
    changeColor();
    $("#makeSure").click(function () {
        var len=$(".InterfaceColor");
        var className1=$("#colorInterface").attr("class");
        var className2=className1.substring(7);
        var className3=className1.substring(0,7);
        var val=$("#color").val();
        for(var i=0;i<len.length;i++){
            if(className2==0){//期号
                if(className3=="colorBg"){
                    $("#qihao th").css("background-color",val);
                    $(".issueTwo").css("background-color",val);
                    $(".shuzhifang .statisticsRowLeft").css("background-color","#00a6a6");
                    cssObj.Color.qihaobg=val;
                }else if(className3=="colorFc"){
                    $("#qihao th").css("color",val);
                    $(".issueTwo").css("color",val);
                    $(".shuzhifang .statisticsRowLeft").css("color","#000");
                    cssObj.Color.qihaofc=val;
                }
            }else if(className2==1){//五位开奖号
                if(className3=="colorBg"){
                    $(".lotteryNumber").css("background-color",val);
                    $(".countDownd").css("background-color",val);
                    $(".rehao").css("background-color","#f60");
                    $(".lenghao").css("background-color","#63cb75");
                    $(".statisticsRow .lotteryNumber").css("background-color","#00a6a6");
                    cssObj.Color.wuweikaijianghaobg=val;
                }else if(className3=="colorFc"){
                    $(".lotteryNumber").css("color",val);
                    $(".statisticsRow .lotteryNumber").css("color","#000");
                    $(".countDownd").css("color",val);
                    cssObj.Color.wuweikaijianghaofc=val;
                }
            }else if(className2==2){//任选分布
                if(className3=="colorBg"){
                    $(".optionalDis").css("background-color",val);
                    $(".statisticsRow .optionalDis").css("background-color","#00a6a6");
                    cssObj.Color.renxuanfenbubg=val;
                    $(".statisticsRow .rehao").css("background-color","#f60");
                    $(".statisticsRow .lenghao").css("background-color","#63cb75");
                }else if(className3=="colorFc"){
                    $(".optionalDis").css("color",val);
                    $(".missVlu").css("color","#999999");
                    $(".statisticsRow .optionalDis").css("color","#006464");
                    cssObj.Color.renxuanfenbufc=val;
                }
            }else if(className2==3){//前三位连线
                if(className3=="colorBg"){
                    $(".firstCon").css("background-color",val);
                    $(".secondCon").css("background-color",val);
                    $(".thirdCon").css("background-color",val);
                    $(".statisticsRow .firstCon").css("background-color","#00a6a6");
                    $(".statisticsRow .secondCon").css("background-color","#00a6a6");
                    $(".statisticsRow .thirdCon").css("background-color","#00a6a6");
                    svgObj[0].bgColor = val;
                    svg(svgObj);
                    cssObj.Color.qiansanweilianxianbg=val;
                }else if(className3=="colorFc"){
                    $(".firstCon").css("color",val);
                    $(".secondCon").css("color",val);
                    $(".thirdCon").css("color",val);
                    $(".statisticsRow .firstCon").css("color","#000");
                    $(".statisticsRow .secondCon").css("color","#000");
                    $(".statisticsRow .thirdCon").css("color","#000");
                    svgObj[0].fontColor =val;
                    svg(svgObj);
                    cssObj.Color.qiansanweilianxianfc=val;
                }
            }else if(className2==4){//关注号码
                if(className3=="colorBg"){
                    $(".attentionNum").css("background-color",val);
                    $(".statisticsRow .attentionNum").css("background-color","#00a6a6");
                    cssObj.Color.guanzhuhaomabg=val;
                }else if(className3=="colorFc"){

                    $(".attentionNum").css("color",val);
                    $(".attentionNumRed").css("color","red");
                    $(".statisticsRow .attentionNum").css("color","#000");
                    cssObj.Color.guanzhuhaomafc=val;
                }
            }else if(className2==5){//三位开奖号
                zitiyanse("threeLotteryNumber","sanweikaijianghaobg","sanweikaijianghaofc",className3,val);
            }else if(className2==6){//重号
                zitiyanse("heavyNumber","chonghaobg","chonghaofc",className3,val);
            }else if(className2==7){ //前三和尾连线 var colorTails="#F1F1D6"
                if(className3=="colorBg"){
                    $(".firstThreeTails").css("background-color",val);
                    $(".statisticsRow .firstThreeTails").css("background-color","#00a6a6");
                    svgObj[1].bgColor = val;
                    svg(svgObj);
                    cssObj.Color.qiansanheweilianxianbg=val;
                    changeSetting();
                }else if(className3=="colorFc"){
                    $(".firstThreeTails").css("color",val);
                    $(".statisticsRow .firstThreeTails").css("color","#000");
                    svgObj[1].fontColor = val;
                    svg(svgObj);
                    cssObj.Color.qiansanheweilianxianfc=val;
                }
            }else if(className2==8){
                zitiyanse("firstThreeValuesBs","hezhidaxiaobg","hezhidaxiaofc",className3,val);
            }else if(className2==9){ //前值
                zitiyanse("firstThreeValues","qianzhibg","qianzhifc",className3,val);
            }else if(className2==10){//和值单双
                zitiyanse("andValueSd","hezhidanshuangbg","hezhidanshuangfc",className3,val);
            }else if(className2==11){  //和值
                zitiyanse("andValueAll","hezhibg","hezhifc",className3,val);
            }else if(className2==12){//奇数
                zitiyanse("Odd","jishubg","jishufc",className3,val);
            }else if(className2==13){//大数
                zitiyanse("bigNum","dashubg","dashufc",className3,val);""
            }else if(className2==14){//前重
                zitiyanse("theFormer","qianchongbg","qianchongfc",className3,val);
            }else if(className2==15){//前重连线
                if(className3=="colorBg"){
                    $(".theFormerLine").css("background-color",val);
                    $(".statisticsRow .theFormerLine").css("background-color","#00a6a6");
                    svgObj[2].bgColor = val;
                    svg(svgObj);
                    cssObj.Color.qianchonglianxianbg=val;
                }else if(className3=="colorFc"){
                    $(".theFormerLine").css("color",val);
                    $(".statisticsRow .theFormerLine").css("color","#000");
                    svgObj[2].fontColor = val;
                    svg(svgObj);
                    cssObj.Color.qianchonglianxianfc=val;
                }
            }else if(className2==16){//重号连线
                if(className3=="colorBg"){
                    $(".heavyNumberLine").css("background-color",val);
                    $(".statisticsRow .heavyNumberLine").css("background-color","#00a6a6");
                    svgObj[3].bgColor =val;
                    svg(svgObj);
                    cssObj.Color.chonghaolianxianbg=val;
                }else if(className3=="colorFc"){
                    $(".heavyNumberLine").css("color",val);
                    $(".statisticsRow .heavyNumberLine").css("color","#000");
                    svgObj[3].fontColor = val;
                    svg(svgObj);
                    cssObj.Color.chonghaolianxianfc=val;
                }
            }else if(className2==17){//前三组分布
                zitiyanse("threeGroupsDis","qiansanzufenbubg","qiansanzufenbufc",className3,val);
            }else if(className2==18){//跨度
                zitiyanse("spanDataTable","kuadubg","kuadufc",className3,val);
            }else if(className2==19){//跨度连线
                if(className3=="colorBg"){
                    $(".spanDataTableLine").css("background-color",val);
                    $(".statisticsRow .spanDataTableLine").css("background-color","#00a6a6");
                    svgObj[4].bgColor = val;
                    svg(svgObj);
                    cssObj.Color.kuadulianxianbg=val;
                }else if(className3=="colorFc"){
                    $(".spanDataTableLine").css("color",val);
                    $(".statisticsRow .spanDataTableLine").css("color","#000");
                    svgObj[4].fontColor = val;
                    svg(svgObj);
                    cssObj.Color.kuadulianxianfc=val;
                }
            }else if(className2==20){ //前跨
                zitiyanse("beforeCross","qiankuabg","qiankuafc",className3,val);
            }else if(className2==21){//前跨连线
                if(className3=="colorBg"){
                    $(".beforeCrossLine").css("background-color",val);
                    $(".statisticsRow .beforeCrossLine").css("background-color","#00a6a6");
                    svgObj[5].bgColor = val;
                    svg(svgObj);
                    cssObj.Color.qiankualianxianbg=val;
                }else if(className3=="colorFc"){
                    $(".beforeCrossLine").css("color",val);
                    $(".statisticsRow .beforeCrossLine").css("color","#000");
                    svgObj[5].fontColor = val;
                    svg(svgObj);
                    cssObj.Color.qiankualianxianfc=val;
                }
            }else if(className2==22){
                if(className3=="colorBg"){
                    svgObj[6].lineColor = val;
                    svg(svgObj);
                    cssObj.Color.lianxian=val;
                }
            }

        }
        if($(".optionsBtn img").eq(1).attr("src")=="img/close.png"){
            $(".optionalDisBlue").css("color","#fff");
            $(".optionalDisRed").css("color","#fff");
        }
        $(".missVlu").css("color","#999");
        changeSetting();
        $("#colorInterface").hide();
    });
    $("#canCle").click(function(){
        $("#colorInterface").hide();
    })
});
function changeColor() {
    for(var i=0;i<$(".color").length;i++){
        (function () {
            var zq=i;
            $(".color").eq(zq).click(function () {

                $("#colorInterface").removeClass();
                $("#colorInterface").show().addClass("colorBg"+$(".color").index(this));
            })
        })();
    }
    for(var iz=0;iz<$(".color1").length;iz++){
        (function () {
            var zp=iz;
            $(".color1").eq(zp).click(function () {

                $("#colorInterface").removeClass();
                $("#colorInterface").show().addClass("colorFc"+$(".color1").index(this));

            })
        })()
    }
}

$(function () {
    /*    var myBox = document.getElementById('main');
     var direction;
     var slider = {
     //判断设备是否支持touch事件
     touch:('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch,
     slider:document.getElementById('main'),

     //事件
     events:{
     index:0,     //显示元素的索引
     slider:myBox,     //this为slider对象
     handleEvent:function(event){
     var self = this;     //this指events对象
     if(event.type == 'touchstart'){
     self.start(event);
     }else if(event.type == 'touchmove'){
     self.move(event);
     }else if(event.type == 'touchend'){
     self.end(event);
     }
     },
     //滑动开始
     start:function(event){
     var touch = event.targetTouches[0];     //touches数组对象获得屏幕上所有的touch，取第一个touch
     startPos = {x:touch.pageX,y:touch.pageY,time:+new Date};    //取第一个touch的坐标值
     isScrolling = 0;   //这个参数判断是垂直滚动还是水平滚动
     myBox.addEventListener('touchmove',this,false);
     myBox.addEventListener('touchend',this,false);
     event.preventDefault();
     },
     //移动
     move:function(event){
     //当屏幕有多个touch或者页面被缩放过，就不执行move操作
     if(event.targetTouches.length > 1 || event.scale && event.scale !== 1) return;
     var touch = event.targetTouches[0];
     endPos = {x:touch.pageX - startPos.x,y:touch.pageY - startPos.y};
     isScrolling = Math.abs(endPos.x) < Math.abs(endPos.y) ? 1:0;    //isScrolling为1时，表示纵向滑动，0为横向滑动
     if(isScrolling === 0){
     if(direction != "top" && Math.abs(endPos.x)>10){
     direction = "left";
     $("#zhuti .dataTable").css('transform', 'translate(' + (startX +endPos.x) + 'px,'+startY+'px) translateZ(0px)');
     $("#topHengDiv table").css('transform', 'translate(' + (startX +endPos.x) + 'px,0px) translateZ(0px)');
     $("#svg").css('transform', 'translate(' + (startX +endPos.x) + 'px,'+startY+'px) translateZ(0px)');

     if($("#zhuti .dataTable").offset().left>20){
     startX = 0;
     endPos.x = 0;
     $("#zhuti .dataTable").css('transform', 'translate(' + (startX) + 'px,'+startY+'px) translateZ(0px)');
     $("#topHengDiv table").css('transform', 'translate(' + (startX) + 'px,0px) translateZ(0px)');
     $("#svg").css('transform', 'translate(' + (startX) + 'px,'+startY+'px) translateZ(0px)');
     }
     var xxx = $("#main").width() - $(".dataTable").width();
     if($("#zhuti .dataTable").offset().left <= xxx){
     startX =xxx - 20;
     $("#zhuti .dataTable").css('transform', 'translate(' + (startX) + 'px,'+startY+'px) translateZ(0px)');
     $("#topHengDiv table").css('transform', 'translate(' + (startX) + 'px,0px) translateZ(0px)');
     $("#svg").css('transform', 'translate(' + (startX) + 'px,'+startY+'px) translateZ(0px)');
     }
     }
     }else if(isScrolling == 1){
     if(direction != "left" && Math.abs(endPos.y)>10){
     direction = "top";
     $("#zhuti .dataTable").css('transform', 'translate('+startX+'px,' + (startY +endPos.y) + 'px) translateZ(0px)');
     $(".shuzhifang table").css('transform', 'translate(0px,' + (startY +endPos.y) + 'px) translateZ(0px)');
     $("#svg").css('transform', 'translate('+startX+'px,' + (startY +endPos.y) + 'px) translateZ(0px)');
     if($("#zhuti .dataTable").offset().top>30+topHengDivHeight){
     startY =0;
     endPos.y = 0;
     $("#zhuti .dataTable").css('transform', 'translate('+startX+'px,' + (startY +endPos.y) + 'px) translateZ(0px)');
     $(".shuzhifang table").css('transform', 'translate(0px,' + (startY +endPos.y) + 'px) translateZ(0px)');
     $("#svg").css('transform', 'translate('+startX+'px,' + (startY +endPos.y) + 'px) translateZ(0px)');
     }
     var yyy = $("#main").height() - $(".dataTable").height() - topHengDivHeight;
     if($("#zhuti .dataTable").offset().top <= $("#main").height() - $(".dataTable").height()+30){
     startY =yyy;
     $("#zhuti .dataTable").css('transform', 'translate('+startX+'px,' + (yyy) + 'px) translateZ(0px)');
     $(".shuzhifang table").css('transform', 'translate(0px,' + (yyy) + 'px) translateZ(0px)');
     $("#svg").css('transform', 'translate('+startX+'px,' + (yyy) + 'px) translateZ(0px)');
     }
     }
     }
     },
     //滑动释放
     end:function(event){
     var duration = +new Date - startPos.time;    //滑动的持续时间
     if(direction == "left"){
     startX = startX +endPos.x;
     }else{
     startY = startY +endPos.y;
     }
     direction = null;

     var yyy = $("#main").height() - $(".dataTable").height() - topHengDivHeight;
     if(startY < yyy){
     startY =yyy;
     $("#zhuti .dataTable").css('transform', 'translate('+startX+'px,' + (yyy) + 'px) translateZ(0px)');
     $(".shuzhifang table").css('transform', 'translate(0px,' + (yyy) + 'px) translateZ(0px)');
     $("#svg").css('transform', 'translate('+startX+'px,' + (yyy) + 'px) translateZ(0px)');
     }
     var xxx = $("#main").width() - $(".dataTable").width() - 20;
     if(startX < xxx){
     startX =xxx;
     $("#zhuti .dataTable").css('transform', 'translate(' + (startX) + 'px,'+startY+'px) translateZ(0px)');
     $("#topHengDiv table").css('transform', 'translate(' + (startX) + 'px,0px) translateZ(0px)');
     $("#svg").css('transform', 'translate(' + (startX) + 'px,'+startY+'px) translateZ(0px)');
     }
     //解绑事件
     myBox.removeEventListener('touchmove',this,false);
     myBox.removeEventListener('touchend',this,false);
     event.preventDefault();
     }
     },
     //初始化
     init:function(){
     var self = this;     //this指slider对象
     if(!!self.touch) self.slider.addEventListener('touchstart',self.events,false);    //addEventListener第二个参数可以传一个对象，会调用该对象的handleEvent属性
     }
     };
     slider.init();*/
    pickArea();
});
function pickArea(){
    var choiceNum = [];
    var bgRed = "radial-gradient(circle at 45px 25px, #ffb5b5,#ae0000)";
    var bgGray = "radial-gradient(circle at 45px 25px, #F0F0F0,#7B7B7B)";
    var methodArray = ["任选一","任选二","任选三","任选四","任选五",
        "任选六","任选七","任选八","选前一","选前二","选前二","选前三","选前三"];
    var objThree = {
        hundreds: "",
        decade: "",
        unit: ""
    };
    var Total = [];
    var source = "";
    var allMoney = 0;
    var res = null;

    if(localStorage.getItem("outTime")){
        $(".mianfei").text("VIP过期:"+localStorage.getItem("outTime")+"(或免费版)");
    }

    if($(window).width()<1079){
        bgGray = "radial-gradient(circle at 20px 10px, #F0F0F0,#7B7B7B)";
        bgRed = "radial-gradient(circle at 20px 10px, #ffb5b5,#ae0000)";
    }
    $(".pick i").click(function () {
        if($("#functionArea").css("display") == "none"||!$(".optionsList").eq(0).is(":hidden")||!$(".InterfaceColor").eq(0).is(":hidden")){
            $("#functionArea").show();
            $("#sphere").show();
            $("#bottomTable").hide();
            $("#groomNum").hide();
            $(".displayAllNumber").hide();
            $(".modalBox").hide();
            $(".optionsList").hide();
            $(".InterfaceColor").hide();
        }else{
            $("#sphere").hide();
            $(".displayAllNumber").hide();
            $(".modalBox").hide();
            $("#bottomTable").show();
            $("#groomNum").show();
            $("#functionArea").hide();
        }
    });

    $(".menuRight i").click(function () {
        if($("#functionArea").is(":hidden")||!$("#sphere").is(":hidden")){
            $("#sphere").hide();
            $("#functionArea").show();    //如果元素为隐藏,则将它显现
            $(".displayAllNumber").hide();
            $(".modalBox").hide();
            $("#bottomTable").hide();
            $("#groomNum").hide();
        }else{
            $("#functionArea").hide();     //如果元素为显现,则将其隐藏
            $("#bottomTable").show();
            $("#groomNum").show();
        }
        $(".optionsList").show();
        $(".InterfaceColor").hide()
    });

    //任选四， 加倍弹出选项
    $(".sphereFun>div>i").click(function(){
        if($(this).siblings(".choicePm").css("display") == "none"){
            $(this).siblings(".choicePm").show();
        }else{
            $(this).siblings(".choicePm").hide();
        }
    });

    //选择一个任选选项 加倍 改变界面
    $(".sphereFun>div").each(function () {
        $(this).find(".choicePm ul li").click(function(){
            var x = $(this).parent().parent().parent().index();
            if(x == 0){
                var method = $(".sphereFun>div").eq(0).find("label").html();
                $(".circle").css("background",bgGray);
                if($.inArray(method,methodArray)>=8){   //如果是组选或者直选  将这个对象清空
                    objThree.hundreds = "";
                    objThree.decade = "";
                    objThree.unit = "";
                }else{                                           //清空数组
                    choiceNum = [];
                }
                if($(this).index() >= 8){
                    $(".positionNum label").css("display","none");
                    if($(this).index() == 8){
                        $(".positionNum span").css("backgroundColor","#D4D2D5");
                        $(".positionNum span").eq(2).css("backgroundColor","#119F99");
                    }else if($(this).index()>8 && $(this).index()<11){
                        $(".positionNum span").css("backgroundColor","#D4D2D5");
                        $(".positionNum span").eq(1).css("backgroundColor","#119F99");
                    }else{
                        $(".positionNum span").css("backgroundColor","#D4D2D5");
                        $(".positionNum span").eq(0).css("backgroundColor","#119F99");
                    }
                }else{
                    $(".positionNum label").css("display","block");
                }
                $(this).parent().parent().css("display","none").siblings("label").html($(this).html().substr(0,3));

            }else if(x == 1){
                if($(this).index() == 0){//自定义
                    $(".modalBox").css("display","block");
                    $(this).parent().parent().css("display","none");
                }else{
                    if($(window).width()<1000){
                        $(".sphereFun>div").eq(1).find("label").css("fontSize","9px");
                    }
                    $(this).parent().parent().css("display","none").siblings("label").html($(this).html()).attr("value",$(this).attr("value"));
                }
            }
        });
    });

    //自定义倍数点击确定或者取消
    $(".modalBox>div>span").click(function(){
        var ex = /^\d+$/;  //判断整数
        if($(this).html() == "确定"){
            var val = $(this).siblings("input").val();
            if(!isNaN(val) && ex.test(val) && val>0){
                if(val >99){
                    if($(window).width()<1079){
                        $(".sphereFun>div").eq(1).find("label").css("fontSize","8px");
                    }else{
                        $(".sphereFun>div").eq(1).find("label").css("fontSize","14px");
                    }
                }
                $(".sphereFun>div").eq(1).find("label").html("加倍X"+val).attr("value",val);
                $(".modalBox").css("display","none");
                val = null;
            }else{
                $(".inputAlert").html("请输入大于1的整数").slideDown();
                setTimeout(function(){
                    $(".inputAlert").slideUp();
                },2000)
            }
        }else if($(this).html() == "取消"){
            $(".modalBox").css("display","none");
            val = null;
        }
    });

    //保存着百位个位和十位的所选球  并将它变成红色
    $(".positionNum span").click(function(){
        var method = $(".sphereFun>div").eq(0).find("label").html();
        if($.inArray(method,methodArray)==8 && $(this).index()<2){
            alert("只允许选择个位的一个球");
            return 0 ;
        }else if($.inArray(method,methodArray)>8 && $.inArray(method,methodArray)<11 && $(this).index()==0){
            alert("只允许选择个位和十位的两个球");
            return 0 ;
        }
        $(".positionNum span").css("backgroundColor","#D4D2D5");
        $(this).css("backgroundColor","#119F99");
        $(".circle").css("background",bgGray);
        if($(this).html() == "十位"){
            var decade = Number(objThree.decade);
            if(decade>0){
                $(".circle").css("background",bgGray);
                $(".circle").eq(decade -1).css("background",bgRed);
            }
        }else if($(this).html() == "个位"){
            var unit = Number(objThree.unit);
            if(unit>0){
                $(".circle").css("background",bgGray);
                $(".circle").eq(unit -1).css("background",bgRed);
            }
        }else{
            var hundreds = Number(objThree.hundreds);
            if(hundreds>0){
                $(".circle").css("background",bgGray);
                $(".circle").eq(hundreds -1).css("background",bgRed);
            }
        }
    });

    //点击球
    $(".stage .circle label").click(function(){
        var method = $(".sphereFun>div").eq(0).find("label").html();
        var doubleNum = $(".sphereFun>div").eq(1).find("label").html();
        if($.inArray(method,methodArray)>=8){   //如果是组选或者直选
            $(".circle").css("background",bgGray);  //先将所有球变成灰色
            if($(".positionNum span").eq(0).css("backgroundColor") == "rgb(17, 159, 153)"){ //百位
                if($(this).html() == objThree.hundreds){       //如果已经选中了  变灰 删除
                    $(this).parent().css("background",bgGray);
                    objThree.hundreds = "";
                }else{
                    $(this).parent().css("background",bgRed); //选中的球位红色 并加到对象中
                    objThree.hundreds = $(this).html();
                }
            }else if($(".positionNum span").eq(1).css("backgroundColor") == "rgb(17, 159, 153)"){ //十位
                if($(this).html() == objThree.decade){       //如果已经选中了  变灰 删除
                    $(this).parent().css("background",bgGray);
                    objThree.decade = "";
                }else{
                    $(this).parent().css("background",bgRed); //选中的球位红色 并加到对象中
                    objThree.decade = $(this).html();
                }
            }else{  //个位
                if($(this).html() == objThree.unit){       //如果已经选中了  变灰 删除
                    $(this).parent().css("background",bgGray);
                    objThree.unit = "";
                }else{
                    $(this).parent().css("background",bgRed); //选中的球位红色 并加到对象中
                    objThree.unit = $(this).html();
                }
            }
        }else{                                           //否则是任选
            if($.inArray($(this).html(),choiceNum)<0){  //如果数组中没有该球
                $(this).parent().css("background",bgRed);
                choiceNum.push($(this).html());
            }else{                                      //如果有该球
                $(this).parent().css("background",bgGray);
                choiceNum.splice(jQuery.inArray($(this).html(),choiceNum),1);
            }
        }
    });

    //点击确定
    $(".middle s").click(function(){   //点击确定后
        $(".allTotal").html("");
        $(".circle").css("background",bgGray);   //变灰

        var method = $(".sphereFun>div").eq(0).find("label").html();   //玩法
        var doubleNum = $(".sphereFun>div").eq(1).find("label").html(); //加倍
        var multiple = Number($(".sphereFun>div").eq(1).find("label").attr("value"));
        var num = "";                                  //所选号字符串
        var sAD = "复式";
        if($.inArray(method,methodArray)>=8){   //如果是组选或者直选 将全部都是单式
            sAD = "单式";
            if($.inArray(method,methodArray)==8){
                num ="  个位"+objThree.unit;
            }else if($.inArray(method,methodArray)>8 && $.inArray(method,methodArray)<11){
                num = "  十位"+objThree.decade+"  个位"+objThree.unit;
            }else{
                num = "百位"+objThree.hundreds+"  十位"+objThree.decade+"  个位"+objThree.unit;
            }
            res = method + ":"+sAD+" "+num+" "+doubleNum + " "+ multiple*2+"元";
            objThree.hundreds = "";
            objThree.decade = "";            //清空
            objThree.unit = "";
        }else{
            num = choiceNum.sort().join(" ");
            if($.inArray(method,methodArray)+1 < choiceNum.length){   //组合
                sAD = "复式";
                var m = choiceNum.length;
                var n = $.inArray(method,methodArray)+1;
                var combinationNumber = factorial(m)/(factorial(n)*(factorial(m-n)));
                multiple *= combinationNumber;
                res = method + "："+sAD+" "+num+" "+doubleNum + " "+ multiple*2+"元";
            }else if($.inArray(method,methodArray)+1 == choiceNum.length) {
                sAD = "单式";
                res = method + ":"+sAD+" "+num+" "+doubleNum + " "+ multiple*2+"元";
            }else{
                var hhh =Number($.inArray(method,methodArray))+1;
                alert("选择的球数不能少于"+hhh+"个");
                res = null;
            }
            choiceNum = [];     //清空
        }

        if(res){
            allMoney += multiple*2;
            source = "determine";   //表明来源是点击确定后  而不是点击已选
            $("#sphere").hide();
            var ppp = "<p>"+res+"</p>";
            $(".displayAllNumber").show().find(".multiLineData").append(ppp);
            Total.push(res);
        }
    });

    //点击返回 清空 复制投注号
    $(".bottomOption button").click(function(){
        if($(this).index() == 0){                 //点击返回
            if($(this).html() == "返回"){
                $("#sphere").show();
                $(".displayAllNumber").hide();
            }else{
                var clipboard = new Clipboard('.js-copy', {
                    text: function() {
                        return Total.join("\r")+"\r"+$(".allTotal").text();
                    }
                });
                //复制成功执行的回调，可选
                clipboard.on('success', function(e) {
                    $(".allTotal").html("复制成功").css("color","blue");
                    setTimeout(function () {
                        $(".allTotal").html("共 : "+ allMoney/2+"注 ， 合计 ： "+allMoney+"元").css("color","black");
                    },2000)
                });

                //复制失败执行的回调，可选
                clipboard.on('error', function(e) {
                    $(".allTotal").html("复制失败").css("color","red");
                    setTimeout(function () {
                        $(".allTotal").html("共 : "+ allMoney/2+"注 ， 合计 ： "+allMoney+"元").css("color","black");
                    },2000)
                });
                return 0;
            }
        }else{                                    //点击清空
            if(source == "determine"){            //判断来源
                Total.pop();
            }else if (source == "selected"){
                Total = [];
                $(".bottomOption>.allTotal").html("");
            }
        }
        $(".multiLineData p").remove();
    });

    //点击已选
    $(".sphereFun .last").click(function(){
        source = "selected";
        $("#sphere").hide();
        $(".displayAllNumber").show();
        $(".bottomOption>.allTotal").html("共 : "+ allMoney/2+"注 ， 合计 ： "+allMoney+"元");
        for(var i =0;i<Total.length;i++){
            var ppp = "<p>"+Total[i]+"</p>";
            $(".multiLineData").append(ppp);
        }
    });

    //分享qq好友
    $(".bottomImg >.qqShare").click(function(){
        var href = window.location.href;
        var leirong;
        var biaoti = $(".headerMiddle").text();
        if(source == "determine"){            //判断来源
            leirong = res;
        }else if (source == "selected"){
            leirong = Total.join("\r\n")+$(".allTotal").text();
        }
        var summary = leirong;
        $(this).attr("href","http://connect.qq.com/widget/shareqq/index.html?url="+href+"&showcount=0&summary="+leirong+"&desc="+leirong+"&title="+biaoti+"&site=jiathis&pics=");
    });

    //分享微信好友
    $(".winXinShare").click(function() {
        var wx = api.require('wx');
        var leirong;
        if (source == "determine") { //判断来源
            leirong = res;
        } else if (source == "selected") {
            leirong = Total.join("  ") + $(".allTotal").text();
        }
        var wx = api.require('wx');
        wx.isInstalled(function(ret, err) {
            if (ret.installed) {
                wx.shareText({
                    apiKey: '',
                    scene: 'session',
                    text: leirong
                }, function(ret, err) {
                    if (ret.status) {
                        alert('分享成功');
                    } else {
                        alert(err.code);
                    }
                });
            } else {
                alert('当前设备未安装微信客户端');
            }
        });
    });

    //点击机选
    $(".sphereFun .machineSel>s").click(function(){
        var method = $(".sphereFun>div").eq(0).find("label").html();   //玩法
        $(".sphereNum section figure").css("background",bgGray);
        choiceNum = [];
        objThree.hundreds = "";
        objThree.decade = "";            //清空
        objThree.unit = "";
        if($.inArray(method,methodArray)>=8){   //如果是组选或者直选 将全部都是单式
            if($.inArray(method,methodArray) == 8){
                var id = randUnique(1,12,1);
                $(".sphereNum section").eq(id-1).find("figure").css("background",bgRed);
                objThree.unit =id<10?id="0"+id:id;
            }else if($.inArray(method,methodArray) >9 && $.inArray(method,methodArray) <11){
                var id = randUnique(1,12,2);
                var tag;
                for(var o=1;o<3;o++){
                    if($(".positionNum span").eq(o).css("backgroundColor") == "rgb(17, 159, 153)"){
                        tag = o;
                    }
                }
                if(tag == 2){  //个位
                    tag = 0;
                }else{
                    tag = 1;
                }
                $(".sphereNum section").eq(id[tag]-1).find("figure").css("background",bgRed);
                objThree.unit =id[0]<10?id[0]="0"+id[0]:id[0];
                objThree.decade =id[1]<10?id[1]="0"+id[1]:id[1];
            }else{
                var id = randUnique(1,12,3);
                var tag;
                for(var o=0;o<3;o++){
                    if($(".positionNum span").eq(o).css("backgroundColor") == "rgb(17, 159, 153)"){
                        tag = o;
                    }
                }
                $(".sphereNum section").eq(id[tag]-1).find("figure").css("background",bgRed);
                objThree.hundreds =id[0]<10?id[0]="0"+id[0]:id[0];
                objThree.decade =id[1]<10?id[1]="0"+id[1]:id[1];
                objThree.unit =id[2]<10?id[2]="0"+id[2]:id[2];
            }
        }else{
            if($.inArray(method,methodArray) == 0){
                var id = randUnique(1,12,1);
                $(".sphereNum section").eq(id-1).find("figure").css("background",bgRed);
                choiceNum.push(id<10?id="0"+id:id);
            }else if($.inArray(method,methodArray) == 1){
                var id = randUnique(1,12,2);
                for(var i=0;i<id.length;i++){
                    $(".sphereNum section").eq(id[i]-1).find("figure").css("background",bgRed);
                    choiceNum.push(id[i]<10?id[i]="0"+id[i]:id[i]);
                }
            }else if($.inArray(method,methodArray) == 2){
                var id = randUnique(1,12,3);
                for(var i=0;i<id.length;i++){
                    $(".sphereNum section").eq(id[i]-1).find("figure").css("background",bgRed);
                    choiceNum.push(id[i]<10?id[i]="0"+id[i]:id[i]);
                }
            }else if($.inArray(method,methodArray) == 3){
                var id = randUnique(1,12,4);
                for(var i=0;i<id.length;i++){
                    $(".sphereNum section").eq(id[i]-1).find("figure").css("background",bgRed);
                    choiceNum.push(id[i]<10?id[i]="0"+id[i]:id[i]);
                }
            }else if($.inArray(method,methodArray) == 4){
                var id = randUnique(1,12,5);
                for(var i=0;i<id.length;i++){
                    $(".sphereNum section").eq(id[i]-1).find("figure").css("background",bgRed);
                    choiceNum.push(id[i]<10?id[i]="0"+id[i]:id[i]);
                }
            }else if($.inArray(method,methodArray) == 5){
                var id = randUnique(1,12,6);
                for(var i=0;i<id.length;i++){
                    $(".sphereNum section").eq(id[i]-1).find("figure").css("background",bgRed);
                    choiceNum.push(id[i]<10?id[i]="0"+id[i]:id[i]);
                }
            }else if($.inArray(method,methodArray) == 6){
                var id = randUnique(1,12,7);
                for(var i=0;i<id.length;i++){
                    $(".sphereNum section").eq(id[i]-1).find("figure").css("background",bgRed);
                    choiceNum.push(id[i]<10?id[i]="0"+id[i]:id[i]);
                }
            }else if($.inArray(method,methodArray) == 7){
                var id = randUnique(1,12,8);
                for(var i=0;i<id.length;i++){
                    $(".sphereNum section").eq(id[i]-1).find("figure").css("background",bgRed);
                    choiceNum.push(id[i]<10?id[i]="0"+id[i]:id[i]);
                }
            }
        }
    });

    //不重复随机号
    function randUnique(start, end, size){
        // 全部随机数值
        var allNums = new Array;

        // 判断获取随机数个数
        size = size ? (size > end - start ? end - start : size) : 1;

        // 生成随机数值区间数组
        for (var i = start, k = 0; i <= end; i++, k++) {
            allNums[k] = i;
        }

        // 打撒数组排序
        allNums.sort(function(){ return 0.5 - Math.random(); });

        // 获取数组从第一个开始到指定个数的下标区间
        return allNums.slice(0, size);
    }

    //递归调用 计算组合
    function factorial(n){
        return n > 1 ? n * factorial(n-1) : 1;
    }
}

function iscroll() {

    var yyy = $("#main").height() - $(".dataTable").height() - topHengDivHeight;

    //设置iscroll
    if($("#screenFull").css("display") == "none" && $(window).width()<1079){
        var win = $(window),
            scrollAreaEl = $('#zhuti'),
            leftFreezeEl = $('.shuzhifang'),
            leftTableEl = leftFreezeEl.find('table'),
            svg = $("#svg"),
            rightTableEl = $('#topHengDiv table');

        //动态计算容器最大高度
        function adjustHeight() {
            scrollAreaEl.height($(".main").height() - $("#qihao").height());
        }

        adjustHeight();
        win.on('resize', adjustHeight);

        var myScroll = new IScroll('#zhuti', {
            scrollX: true,
            scrollY: true,
            bounce:false,
            momentum:false,
            probeType: 3
        });

        var shuzhiScroll = new IScroll('.shuzhifang', {
            scrollX: true,
            scrollY: true,
            bounce:false,
            momentum:false,
            probeType: 3
        });

        //阻止默认滚动
        scrollAreaEl.on('touchmove mousewheel', function(e) {
            e.preventDefault();
        });

        if(yyy!=0){
            myScroll.scrollTo(0, yyy, 0, IScroll.utils.ease.elastic);
            shuzhiScroll.scrollTo(0, yyy, 0, IScroll.utils.ease.elastic);
            svg.css('transform', 'translate(' + 0 + 'px, ' + yyy + 'px) translateZ(0px)');
        }
        shuzhiScroll.disable();
        //固定上左表头的滚动
        myScroll.on('scroll', updatePosition);
        myScroll.on('scrollEnd', updatePosition);
        function updatePosition() {
            var b = this.x;
            var a = this.y;
            leftTableEl.css('transform', 'translate(0px, ' + a + 'px) translateZ(0px)');
            rightTableEl.css('transform', 'translate(' + b + 'px, 0px) translateZ(0px)');
            svg.css('transform', 'translate(' + b + 'px, ' + a + 'px) translateZ(0px)');
        }
    }
}

//此处修改
function quyuanjiance(){
    var closeOrOpen=$(".optionsBtn img").eq(1).attr("src");
    if(closeOrOpen=='img/open.png'){

        $(".optionalDisRed").css("background-image","url()");
        $(".optionalDisBlue").css("background-image","url()");
        $(".optionalDisBlue").css("color",$("#HengDiv .optionalDis").css("color")).css("font-weight","500");
        $(".optionalDisRed").css("color",$("#HengDiv .optionalDis").css("color")).css("font-weight","500");

        $(".missVlu").css("color","#999");
        cssObj.quyuan=true;
        cssObj.qianyiziti=false;
        cssObj.qiansanziti=false;
    }else{
        $(".optionsBtn img").eq(1).attr("src","img/close.png");
        $(".optionalDisRed").css("background-image","url(./img/blue.png)").css("background-size","18px 21px");
        $(".optionalDisBlue").css("background-image","url(./img/blue.png)").css("background-size","18px 21px");
        $(".optionsBtn img").eq(2).attr("src","img/close.png");
        $(".optionalDisBlue").css("color","#ffffff").css("font-weight","500");
        $(".optionalDisRed").css("color","#ffffff").css("font-weight","500");
        $(".missVlu").css("color","#999");
        cssObj.quyuan=false;

        var closeOrOpen1=$(".optionsBtn img").eq(3).attr("src");
        if(closeOrOpen1=='img/open.png'){
            $(".optionalDisRed").css("background-image","url(./img/red.png)").css("background-size","18px 21px");
            $(".optionalDisBlue").css("background-image","url(./img/blue.png)").css("background-size","18px 21px");
            $(".optionalDisRed").css("background-image","url(./img/red.png)").css("background-size","18px 21px");
            cssObj.qiansanziti=true;
            cssObj.quyuan=false;
            cssObj.qianyiziti=false;
        }else{
            $(".optionsBtn img").eq(3).attr("src","img/close.png");
            $(".optionalDisRed").css("background-image","url(./img/blue.png)").css("background-size","18px 21px");
            cssObj.qiansanziti=false;

            var closeOrOpen3=$(".optionsBtn img").eq(2).attr("src");
            if(closeOrOpen3=='img/close.png'){
                $(".optionalDisBlue").css("color","#ffffff").css("font-weight","500");
                $(".optionalDisRed").css("color","#ffffff").css("font-weight","500");
                $(".optionalDisRed").css("background-image","url(./img/red.png)").css("background-size","18px 21px");
                $(".optionalDisBlue").css("background-image","url(./img/blue.png)").css("background-size","18px 21px");
                $(".optionsBtn img").eq(2).attr("src","img/open.png");
                $(".optionsBtn img").eq(3).attr("src","img/close.png");
                $(".optionsBtn img").eq(1).attr("src","img/close.png");
                $(".optionalDisRed").css("background-image","url(./img/blue.png)").css("background-size","18px 21px");
                //方法
                var first=[];
                for(var i=1;i<$(".dataTable tbody tr").length-1;i++){
                    first[i-1]=$(".lotteryNumber").eq(i*5+1).html();
                }
                for(var i=1;i<$(".dataTable tbody tr").length;i++){
                    $(".dataTable tbody tr").eq(i-1).find(".optionalDis").eq(first[i-1]-1).css("background-image","url(./img/red.png)").css("background-size","18px 21px");
                }
                cssObj.quyuan=false;
                cssObj.qianyiziti=true;
                cssObj.qiansanziti=false;
            }else{
                $(".optionalDisRed").css("background-image","url(./img/blue.png)").css("background-size","18px 21px");
                $(".optionsBtn img").eq(2).attr("src","img/close.png");
                $(".optionalDisBlue").css("color","#ffffff").css("font-weight","500");
                $(".optionalDisRed").css("color","#ffffff").css("font-weight","500");
                cssObj.qianyiziti=false;
            }

        }

    }
}

function backgroundSize(){
    if($(".dataTable").css("font-family")=="ZT02"){
        $(".optionalDisRed").css("background-size","18px 18px");
        $(".optionalDisBlue").css("background-size","18px 18px");
    }else{
        $(".optionalDisRed").css("background-size","18px 21px");
        $(".optionalDisBlue").css("background-size","18px 21px");
    }
}
//广告
$(function () {

    var username=localStorage.getItem("username");
    var token=localStorage.getItem("token");
    $.ajax({

        type:"POST",
        url:"http://zcai.cn/getUserInfo",
        dataType:"JSON",
        data:{
            username:username,
            token:token
        },
        success:function (text) {

            if($(window).width()>500) {
                if (text.msg == 1) {

                    if (text.data[0].过期时间 != '') {



                    } else {

                        localStorage.removeItem("outTime");
                        $("#bottom").attr("style", "background: url('img/adv1.jpg')no-repeat center;background-size: cover");
                        $("#bottomTable").attr("style", "visibility: hidden");
                        $(".menu").attr("style", "visibility: hidden");
                        $("#groomNum").attr("style", "visibility: hidden");
                        $("#functionArea").attr("style", "visibility: hidden");
                    }
                } else {
                    localStorage.removeItem("username");
                    localStorage.removeItem("token");
                    localStorage.removeItem("outTime");
                    $("#noLogin").css("display", "block");
                    $("#loginEd").css("display", "none");
                    $("#bottom").attr("style", "background: url('img/adv1.jpg')no-repeat center;background-size: cover");
                    $("#bottomTable").attr("style", "visibility: hidden");
                    $(".menu").attr("style", "visibility: hidden");
                    $("#groomNum").attr("style", "visibility: hidden");
                    $("#functionArea").attr("style", "visibility: hidden");
                }
            }else{
                if (text.msg == 1) {

                    if (text.data[0].过期时间 != '') {
                    } else {

                        localStorage.removeItem("outTime");

                        $("#bottom").attr("style", "background: url('img/adv3.jpg')no-repeat center;background-size: cover");
                        $("#bottomTable").css("visibility","hidden");
                        $(".menu").css("visibility","hidden");
                        $("#groomNum").css("visibility","hidden");
                        $("#functionArea").css("visibility","hidden");
                    }
                } else {
                    localStorage.removeItem("username");
                    localStorage.removeItem("token");
                    localStorage.removeItem("outTime");
                    $("#noLogin").css("display", "block");
                    $("#loginEd").css("display", "none");
                    $("#bottom").attr("style", "background: url('img/adv3.jpg')no-repeat center;background-size: cover");
                    $("#bottomTable").css("visibility","hidden");
                    $(".menu").css("visibility","hidden");
                    $("#groomNum").css("visibility","hidden");
                    $("#functionArea").css("visibility","hidden");
                }
            }

        }

    });

});